transform secret from string to slice

This commit is contained in:
Simon Vieille 2024-02-14 17:59:30 +01:00
commit 571bdce941
4 changed files with 9 additions and 9 deletions

View file

@ -183,11 +183,11 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
Usage: "forwards environment variables as custom arguments to the build",
Destination: &settings.Build.ArgsEnv,
},
&cli.StringFlag{
Name: "secret",
EnvVars: []string{"PLUGIN_SECRET"},
Usage: "sets custom secret argument for the build",
Destination: &settings.Build.Secret,
&cli.StringSliceFlag{
Name: "secrets",
EnvVars: []string{"PLUGIN_SECRETS"},
Usage: "sets custom secret arguments for the build",
Destination: &settings.Build.Secrets,
},
&cli.BoolFlag{
Name: "quiet",

View file

@ -118,7 +118,7 @@ docker-build:
| `default_labels`/`auto_labels` | `true` | sets docker image labels based on git information |
| `build_args` | _none_ | sets custom build arguments for the build |
| `build_args_from_env` | _none_ | forwards environment variables as custom arguments to the build |
| `secret` | _none_ | Sets the build secret for the build |
| `secrets` | _none_ | Sets the build secrets for the build |
| `quiet` | `false` | enables suppression of the build output |
| `target` | _none_ | sets the build target to use |
| `cache_from` | _none_ | sets configuration for cache source |

View file

@ -94,8 +94,8 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd {
for _, arg := range append(defaultBuildArgs, build.Args.Value()...) {
args = append(args, "--build-arg", arg)
}
if build.Secret != "" {
args = append(args, "--secret", build.Secret)
for _, secret := range build.Secrets.Value() {
args = append(args, "--secret", secret)
}
for _, host := range build.AddHost.Value() {
args = append(args, "--add-host", host)

View file

@ -69,7 +69,7 @@ type Build struct {
Platforms cli.StringSlice // Docker build target platforms
Args cli.StringSlice // Docker build args
ArgsEnv cli.StringSlice // Docker build args from env
Secret string // Docker build secret
Secrets cli.StringSlice // Docker build secret
Target string // Docker build target
Output string // Docker build output
Pull bool // Docker build pull