diff --git a/cmd/docker-buildx/config.go b/cmd/docker-buildx/config.go index c2671aa..8e1e2c5 100644 --- a/cmd/docker-buildx/config.go +++ b/cmd/docker-buildx/config.go @@ -196,11 +196,11 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag { Usage: "images to consider as cache sources", Value: &drone.StringSliceFlag{}, }, - &cli.StringSliceFlag{ + &cli.GenericFlag{ Name: "cache-to", EnvVars: []string{"PLUGIN_CACHE_TO"}, Usage: "cache destination for the build cache", - Destination: &settings.Build.CacheTo, + Destination: &drone.StringSliceFlag{}, }, &cli.BoolFlag{ Name: "pull-image", diff --git a/cmd/docker-buildx/main.go b/cmd/docker-buildx/main.go index abdc982..6a63778 100644 --- a/cmd/docker-buildx/main.go +++ b/cmd/docker-buildx/main.go @@ -47,9 +47,14 @@ func run(settings *plugin.Settings) cli.ActionFunc { if !ok { return fmt.Errorf("failed to read cache-from input") } - settings.Build.CacheFrom = cacheFrom.Get() + cacheTo, ok := ctx.Generic("cache-to").(*drone.StringSliceFlag) + if !ok { + return fmt.Errorf("failed to read cache-to input") + } + settings.Build.CacheTo = cacheTo.Get() + plugin := plugin.New( *settings, urfave.PipelineFromContext(ctx), diff --git a/plugin/docker.go b/plugin/docker.go index 0da6336..80c03c9 100644 --- a/plugin/docker.go +++ b/plugin/docker.go @@ -81,7 +81,7 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd { for _, arg := range build.CacheFrom { args = append(args, "--cache-from", arg) } - for _, arg := range build.CacheTo.Value() { + for _, arg := range build.CacheTo { args = append(args, "--cache-to", arg) } for _, arg := range build.ArgsEnv.Value() { diff --git a/plugin/impl.go b/plugin/impl.go index 9e7e0f9..53d4207 100644 --- a/plugin/impl.go +++ b/plugin/impl.go @@ -65,7 +65,7 @@ type Build struct { Output string // Docker build output Pull bool // Docker build pull CacheFrom []string // Docker build cache-from - CacheTo cli.StringSlice // Docker build cache-to + CacheTo []string // Docker build cache-to Compress bool // Docker build compress Repo cli.StringSlice // Docker build repository NoCache bool // Docker build no-cache