0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-28 08:10:36 +00:00

fix: allow escaping of commas in plugin list options (#142)

This commit is contained in:
Robert Kaussow 2022-10-31 20:10:18 +01:00 committed by GitHub
parent f058ddd6d7
commit 248b7a5b77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 8 deletions

View File

@ -2,6 +2,7 @@ package main
import ( import (
"github.com/thegeeklab/drone-docker-buildx/plugin" "github.com/thegeeklab/drone-docker-buildx/plugin"
"github.com/thegeeklab/drone-plugin-lib/v2/drone"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@ -202,11 +203,11 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
Destination: &settings.Build.Target, Destination: &settings.Build.Target,
Category: category, Category: category,
}, },
&cli.StringSliceFlag{ &cli.GenericFlag{
Name: "cache-from", Name: "cache-from",
EnvVars: []string{"PLUGIN_CACHE_FROM"}, EnvVars: []string{"PLUGIN_CACHE_FROM"},
Usage: "images to consider as cache sources", Usage: "images to consider as cache sources",
Destination: &settings.Build.CacheFrom, Value: &drone.StringSliceFlag{},
Category: category, Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{

View File

@ -9,6 +9,7 @@ import (
"github.com/thegeeklab/drone-docker-buildx/plugin" "github.com/thegeeklab/drone-docker-buildx/plugin"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"github.com/thegeeklab/drone-plugin-lib/v2/drone"
"github.com/thegeeklab/drone-plugin-lib/v2/urfave" "github.com/thegeeklab/drone-plugin-lib/v2/urfave"
) )
@ -45,6 +46,8 @@ func run(settings *plugin.Settings) cli.ActionFunc {
return func(ctx *cli.Context) error { return func(ctx *cli.Context) error {
urfave.LoggingFromContext(ctx) urfave.LoggingFromContext(ctx)
settings.Build.CacheFrom = ctx.Generic("cache-from").(*drone.StringSliceFlag).Get()
plugin := plugin.New( plugin := plugin.New(
*settings, *settings,
urfave.PipelineFromContext(ctx), urfave.PipelineFromContext(ctx),

View File

@ -87,7 +87,7 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd {
if build.NoCache { if build.NoCache {
args = append(args, "--no-cache") args = append(args, "--no-cache")
} }
for _, arg := range build.CacheFrom.Value() { for _, arg := range build.CacheFrom {
args = append(args, "--cache-from", arg) args = append(args, "--cache-from", arg)
} }
if build.CacheTo != "" { if build.CacheTo != "" {

View File

@ -53,7 +53,7 @@ type Build struct {
ArgsEnv cli.StringSlice // Docker build args from env ArgsEnv cli.StringSlice // Docker build args from env
Target string // Docker build target Target string // Docker build target
Pull bool // Docker build pull Pull bool // Docker build pull
CacheFrom cli.StringSlice // Docker build cache-from CacheFrom []string // Docker build cache-from
CacheTo string // Docker build cache-to CacheTo string // Docker build cache-to
Compress bool // Docker build compress Compress bool // Docker build compress
Repo string // Docker build repository Repo string // Docker build repository