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:
parent
c7c3ad6942
commit
89db4c201e
@ -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"
|
||||
```
|
||||
|
||||
|
@ -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,
|
||||
},
|
||||
}
|
||||
|
@ -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),
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user