fix: use buildx builder if provided
This commit is contained in:
parent
248b7a5b77
commit
aa2eead79d
|
@ -1,5 +1,10 @@
|
|||
---
|
||||
properties:
|
||||
builder_name:
|
||||
description: Buildx builder to use.
|
||||
type: string
|
||||
required: false
|
||||
|
||||
dry_run:
|
||||
description: Disable docker push.
|
||||
type: bool
|
||||
|
|
|
@ -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"},
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue