From 08ca33ec76d4d9c198774daabf8b2e47af9ab019 Mon Sep 17 00:00:00 2001 From: David Kovari Date: Sun, 21 Jan 2024 13:40:57 -0600 Subject: [PATCH] cache_to and cache_from are now string instead of cli.StringSlice --- cmd/docker-buildx/config.go | 4 ++-- plugin/docker.go | 8 ++++---- plugin/impl.go | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/docker-buildx/config.go b/cmd/docker-buildx/config.go index 17c8b2a..550ec3c 100644 --- a/cmd/docker-buildx/config.go +++ b/cmd/docker-buildx/config.go @@ -195,13 +195,13 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag { Usage: "sets the build target to use", Destination: &settings.Build.Target, }, - &cli.StringSliceFlag{ + &cli.StringFlag{ Name: "cache-from", EnvVars: []string{"PLUGIN_CACHE_FROM"}, Usage: "sets images to consider as cache sources", Destination: &settings.Build.CacheFrom, }, - &cli.StringSliceFlag{ + &cli.StringFlag{ Name: "cache-to", EnvVars: []string{"PLUGIN_CACHE_TO"}, Usage: "cache destination for the build cache", diff --git a/plugin/docker.go b/plugin/docker.go index e5d2ff4..88c965b 100644 --- a/plugin/docker.go +++ b/plugin/docker.go @@ -78,11 +78,11 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd { if build.NoCache { args = append(args, "--no-cache") } - for _, arg := range build.CacheFrom.Value() { - args = append(args, "--cache-from", arg) + if build.CacheFrom != "" { + args = append(args, "--cache-from", build.CacheFrom) } - for _, arg := range build.CacheTo.Value() { - args = append(args, "--cache-to", arg) + if build.CacheTo != "" { + args = append(args, "--cache-to", build.CacheTo) } for _, arg := range build.ArgsEnv.Value() { addProxyValue(&build, arg) diff --git a/plugin/impl.go b/plugin/impl.go index f920ef4..053a577 100644 --- a/plugin/impl.go +++ b/plugin/impl.go @@ -72,8 +72,8 @@ type Build struct { Target string // Docker build target Output string // Docker build output Pull bool // Docker build pull - CacheFrom cli.StringSlice // Docker build cache-from - CacheTo cli.StringSlice // Docker build cache-to + CacheFrom string // Docker build cache-from + CacheTo string // Docker build cache-to Compress bool // Docker build compress Repo cli.StringSlice // Docker build repository NoCache bool // Docker build no-cache