0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-24 12:50:41 +00:00

feat: add extra_tags option to set tags including additional registries (#134)

This commit is contained in:
Richard Jennings 2022-10-09 13:05:05 +01:00 committed by GitHub
parent 4171f3d711
commit 0bd2634a1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 0 deletions

View File

@ -117,6 +117,14 @@ properties:
type: string type: string
required: false required: false
extra_tags:
description: |
Set additional tags to be used for the image. Additional tags can also be loaded from an `.extratags` file. This function can be used
to push images to multiple registries at once. Therefore, it is necessary to use the `config` flag to provide a configuration file
that contains the authentication information for all used registries.
type: list
required: false
build_args: build_args:
description: Ccustom build arguments to pass to the build. description: Ccustom build arguments to pass to the build.
type: list type: list

View File

@ -158,6 +158,14 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
Destination: &settings.Build.TagsSuffix, Destination: &settings.Build.TagsSuffix,
Category: category, Category: category,
}, },
&cli.StringSliceFlag{
Name: "extra.tags",
EnvVars: []string{"PLUGIN_EXTRA_TAGS"},
Usage: "additional tags to use for the image including registry",
FilePath: ".extratags",
Destination: &settings.Build.ExtraTags,
Category: category,
},
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Name: "args", Name: "args",
EnvVars: []string{"PLUGIN_BUILD_ARGS"}, EnvVars: []string{"PLUGIN_BUILD_ARGS"},

View File

@ -123,6 +123,10 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd {
args = append(args, "-t", fmt.Sprintf("%s:%s", build.Repo, arg)) args = append(args, "-t", fmt.Sprintf("%s:%s", build.Repo, arg))
} }
for _, arg := range build.ExtraTags.Value() {
args = append(args, "-t", arg)
}
for _, arg := range build.Labels.Value() { for _, arg := range build.Labels.Value() {
args = append(args, "--label", arg) args = append(args, "--label", arg)
} }

View File

@ -47,6 +47,7 @@ type Build struct {
TagsAuto bool // Docker build auto tag TagsAuto bool // Docker build auto tag
TagsSuffix string // Docker build tags with suffix TagsSuffix string // Docker build tags with suffix
Tags cli.StringSlice // Docker build tags Tags cli.StringSlice // Docker build tags
ExtraTags cli.StringSlice // Docker build tags including registry
Platforms cli.StringSlice // Docker build target platforms Platforms cli.StringSlice // Docker build target platforms
Args cli.StringSlice // Docker build args Args cli.StringSlice // Docker build args
ArgsEnv cli.StringSlice // Docker build args from env ArgsEnv cli.StringSlice // Docker build args from env