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:
parent
f058ddd6d7
commit
248b7a5b77
@ -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,12 +203,12 @@ 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{
|
||||||
Name: "cache-to",
|
Name: "cache-to",
|
||||||
|
@ -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),
|
||||||
|
@ -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 != "" {
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user