0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-28 08:10:36 +00:00

feat: add support for docker build secrets (#282)

This commit is contained in:
Moein Nemati 2023-06-28 21:26:07 +03:00 committed by GitHub
parent 471b9e046d
commit a572b72527
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 0 deletions

View File

@ -265,3 +265,8 @@ properties:
description: Generate [sbom](https://docs.docker.com/build/attestations/sbom/) attestation for the build (shorthand for `--attest type=sbom`).
type: string
required: false
- name: secrets
description: Pass [secrets](https://docs.docker.com/engine/reference/commandline/buildx_build/#secret) when building.
type: list
required: false

View File

@ -321,5 +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: "secret key-value pairs",
Destination: &settings.Build.Secrets,
Category: category,
},
}
}

View File

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

View File

@ -65,6 +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 secret key-pairs
}
// Settings for the Plugin.