mirror of
https://github.com/thegeeklab/drone-docker-buildx.git
synced 2024-11-16 17:40:39 +00:00
fix secrets format
This commit is contained in:
parent
c7c3ad6942
commit
9dcea580f2
@ -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,12 +321,12 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
|
||||
Destination: &settings.Build.SBOM,
|
||||
Category: category,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "secrets",
|
||||
EnvVars: []string{"PLUGIN_SECRETS"},
|
||||
Usage: "exposes secrets to the build",
|
||||
Destination: &settings.Build.Secrets,
|
||||
Category: category,
|
||||
&cli.GenericFlag{
|
||||
Name: "secrets",
|
||||
EnvVars: []string{"PLUGIN_SECRETS"},
|
||||
Usage: "exposes secrets to the build",
|
||||
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