0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-22 00:00:40 +00:00

fix: fix secrets format (#285)

This commit is contained in:
Grégoire Joncour 2023-06-29 21:16:20 +02:00 committed by GitHub
parent c7c3ad6942
commit 89db4c201e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 9 deletions

View File

@ -112,7 +112,8 @@ steps:
from_secret: secure_token
settings:
secrets:
- "id=raw_file_secret,src=file.txt"
- "id=raw_file_secret\\\\,src=file.txt"
- 'id=other_raw_file_secret\\,src=other_file.txt'
- "id=SECRET_TOKEN"
```

View File

@ -321,11 +321,11 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
Destination: &settings.Build.SBOM,
Category: category,
},
&cli.StringSliceFlag{
&cli.GenericFlag{
Name: "secrets",
EnvVars: []string{"PLUGIN_SECRETS"},
Usage: "exposes secrets to the build",
Destination: &settings.Build.Secrets,
Value: &drone.StringSliceFlag{},
Category: category,
},
}

View File

@ -57,6 +57,13 @@ func run(settings *plugin.Settings) cli.ActionFunc {
settings.Build.CacheFrom = cacheFrom.Get()
secrets, ok := ctx.Generic("secrets").(*drone.StringSliceFlag)
if !ok {
return fmt.Errorf("%w: failed to read secrets input", ErrTypeAssertionFailed)
}
settings.Build.Secrets = secrets.Get()
plugin := plugin.New(
*settings,
urfave.PipelineFromContext(ctx),

View File

@ -160,7 +160,7 @@ func commandBuild(build Build, dryrun bool) *execabs.Cmd {
args = append(args, "--sbom", build.SBOM)
}
for _, secret := range build.Secrets.Value() {
for _, secret := range build.Secrets {
args = append(args, "--secret", secret)
}

View File

@ -65,7 +65,7 @@ type Build struct {
Labels cli.StringSlice // Docker build labels
Provenance string // Docker build provenance attestation
SBOM string // Docker build sbom attestation
Secrets cli.StringSlice // Docker build secrets
Secrets []string // Docker build secrets
}
// Settings for the Plugin.