diff --git a/_docs/data/data.yaml b/_docs/data/data.yaml index 2735f9e..a48060e 100644 --- a/_docs/data/data.yaml +++ b/_docs/data/data.yaml @@ -1,5 +1,10 @@ --- properties: + builder_name: + description: Buildx builder to use. + type: string + required: false + dry_run: description: Disable docker push. type: bool diff --git a/cmd/drone-docker-buildx/config.go b/cmd/drone-docker-buildx/config.go index 671cfc2..bf4a631 100644 --- a/cmd/drone-docker-buildx/config.go +++ b/cmd/drone-docker-buildx/config.go @@ -9,6 +9,13 @@ import ( // settingsFlags has the cli.Flags for the plugin.Settings. func settingsFlags(settings *plugin.Settings, category string) []cli.Flag { return []cli.Flag{ + &cli.StringFlag{ + Name: "builder-name", + EnvVars: []string{"PLUGIN_BUILDER_NAME"}, + Usage: "the buildx builder to use", + Destination: &settings.Build.BuilderName, + Category: category, + }, &cli.BoolFlag{ Name: "dry-run", EnvVars: []string{"PLUGIN_DRY_RUN"}, diff --git a/plugin/docker.go b/plugin/docker.go index 7e08116..e1c2995 100644 --- a/plugin/docker.go +++ b/plugin/docker.go @@ -75,6 +75,9 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd { } args = append(args, build.Context) + if build.BuilderName != "" { + args = append(args, "--builder-name", build.BuilderName) + } if !dryrun && build.Output == "" && len(build.Tags.Value()) > 0 { args = append(args, "--push") } diff --git a/plugin/impl.go b/plugin/impl.go index 58cab52..77b3c03 100644 --- a/plugin/impl.go +++ b/plugin/impl.go @@ -63,6 +63,7 @@ type Build struct { Output string // Docker build output folder NamedContext cli.StringSlice // Docker build named context Labels cli.StringSlice // Docker build labels + BuilderName string // Docker buildx builder } // Settings for the Plugin.