mirror of
https://github.com/thegeeklab/drone-docker-buildx.git
synced 2024-06-01 16:09:41 +02:00
fix: use buildx builder if provided
This commit is contained in:
parent
248b7a5b77
commit
aa2eead79d
|
@ -1,5 +1,10 @@
|
||||||
---
|
---
|
||||||
properties:
|
properties:
|
||||||
|
builder_name:
|
||||||
|
description: Buildx builder to use.
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
dry_run:
|
dry_run:
|
||||||
description: Disable docker push.
|
description: Disable docker push.
|
||||||
type: bool
|
type: bool
|
||||||
|
|
|
@ -9,6 +9,13 @@ import (
|
||||||
// settingsFlags has the cli.Flags for the plugin.Settings.
|
// settingsFlags has the cli.Flags for the plugin.Settings.
|
||||||
func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
|
func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
|
||||||
return []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{
|
&cli.BoolFlag{
|
||||||
Name: "dry-run",
|
Name: "dry-run",
|
||||||
EnvVars: []string{"PLUGIN_DRY_RUN"},
|
EnvVars: []string{"PLUGIN_DRY_RUN"},
|
||||||
|
|
|
@ -75,6 +75,9 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd {
|
||||||
}
|
}
|
||||||
|
|
||||||
args = append(args, build.Context)
|
args = append(args, build.Context)
|
||||||
|
if build.BuilderName != "" {
|
||||||
|
args = append(args, "--builder-name", build.BuilderName)
|
||||||
|
}
|
||||||
if !dryrun && build.Output == "" && len(build.Tags.Value()) > 0 {
|
if !dryrun && build.Output == "" && len(build.Tags.Value()) > 0 {
|
||||||
args = append(args, "--push")
|
args = append(args, "--push")
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@ type Build struct {
|
||||||
Output string // Docker build output folder
|
Output string // Docker build output folder
|
||||||
NamedContext cli.StringSlice // Docker build named context
|
NamedContext cli.StringSlice // Docker build named context
|
||||||
Labels cli.StringSlice // Docker build labels
|
Labels cli.StringSlice // Docker build labels
|
||||||
|
BuilderName string // Docker buildx builder
|
||||||
}
|
}
|
||||||
|
|
||||||
// Settings for the Plugin.
|
// Settings for the Plugin.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user