diff --git a/_docs/data/data.yaml b/_docs/data/data.yaml index b4d4408..ad963b8 100644 --- a/_docs/data/data.yaml +++ b/_docs/data/data.yaml @@ -117,6 +117,11 @@ properties: type: string required: false + extra_tags: + description: Set additional tags which include the resgitry. + type: list + required: false + build_args: description: Ccustom build arguments to pass to the build. type: list diff --git a/cmd/drone-docker-buildx/config.go b/cmd/drone-docker-buildx/config.go index f259c70..3446a8a 100644 --- a/cmd/drone-docker-buildx/config.go +++ b/cmd/drone-docker-buildx/config.go @@ -158,6 +158,13 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag { Destination: &settings.Build.TagsSuffix, Category: category, }, + &cli.StringSliceFlag{ + Name: "extra.tags", + EnvVars: []string{"PLUGIN_EXTRA_TAGS"}, + Usage: "extra tags to use for the image including registry", + Destination: &settings.Build.ExtraTags, + Category: category, + }, &cli.StringSliceFlag{ Name: "args", EnvVars: []string{"PLUGIN_BUILD_ARGS"}, diff --git a/plugin/docker.go b/plugin/docker.go index bbbdd69..5ece2c3 100644 --- a/plugin/docker.go +++ b/plugin/docker.go @@ -123,6 +123,10 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd { 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() { args = append(args, "--label", arg) } diff --git a/plugin/impl.go b/plugin/impl.go index 1550500..296a86d 100644 --- a/plugin/impl.go +++ b/plugin/impl.go @@ -47,6 +47,7 @@ type Build struct { TagsAuto bool // Docker build auto tag TagsSuffix string // Docker build tags with suffix Tags cli.StringSlice // Docker build tags + ExtraTags cli.StringSlice // Docker build tags including registry Platforms cli.StringSlice // Docker build target platforms Args cli.StringSlice // Docker build args ArgsEnv cli.StringSlice // Docker build args from env