0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-24 12:50:41 +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 (
"github.com/thegeeklab/drone-docker-buildx/plugin"
"github.com/thegeeklab/drone-plugin-lib/v2/drone"
"github.com/urfave/cli/v2"
)
@ -202,11 +203,11 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
Destination: &settings.Build.Target,
Category: category,
},
&cli.StringSliceFlag{
&cli.GenericFlag{
Name: "cache-from",
EnvVars: []string{"PLUGIN_CACHE_FROM"},
Usage: "images to consider as cache sources",
Destination: &settings.Build.CacheFrom,
Value: &drone.StringSliceFlag{},
Category: category,
},
&cli.StringFlag{

View File

@ -9,6 +9,7 @@ import (
"github.com/thegeeklab/drone-docker-buildx/plugin"
"github.com/urfave/cli/v2"
"github.com/thegeeklab/drone-plugin-lib/v2/drone"
"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 {
urfave.LoggingFromContext(ctx)
settings.Build.CacheFrom = ctx.Generic("cache-from").(*drone.StringSliceFlag).Get()
plugin := plugin.New(
*settings,
urfave.PipelineFromContext(ctx),

View File

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

View File

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