Also convert cacheto to workaround
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Nicolai Ort 2023-11-12 17:08:59 +01:00
parent 8a6a576334
commit d30c0c6e99
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F
4 changed files with 10 additions and 5 deletions

View File

@ -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",

View File

@ -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),

View File

@ -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() {

View File

@ -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