mirror of
https://github.com/thegeeklab/wp-docker-buildx.git
synced 2024-11-10 03:30:40 +00:00
fix: allow escaping of commas in plugin list options (#142)
This commit is contained in:
parent
f058ddd6d7
commit
248b7a5b77
@ -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,12 +203,12 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
|
||||
Destination: &settings.Build.Target,
|
||||
Category: category,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "cache-from",
|
||||
EnvVars: []string{"PLUGIN_CACHE_FROM"},
|
||||
Usage: "images to consider as cache sources",
|
||||
Destination: &settings.Build.CacheFrom,
|
||||
Category: category,
|
||||
&cli.GenericFlag{
|
||||
Name: "cache-from",
|
||||
EnvVars: []string{"PLUGIN_CACHE_FROM"},
|
||||
Usage: "images to consider as cache sources",
|
||||
Value: &drone.StringSliceFlag{},
|
||||
Category: category,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "cache-to",
|
||||
|
@ -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),
|
||||
|
@ -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 != "" {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user