0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-21 13:50:39 +00:00

feat: add option to configure provenance attestation (#171)

This commit is contained in:
Robert Kaussow 2023-01-12 11:28:22 +01:00 committed by GitHub
parent 6278d55b41
commit 13e353b883
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 0 deletions

View File

@ -255,3 +255,8 @@ properties:
description: Labels to add to the image.
type: list
required: false
- name: provenance
description: Generate [provenance](https://docs.docker.com/build/attestations/slsa-provenance/) attestation for the build (shorthand for `--attest=type=provenance`).
type: string
required: false

View File

@ -305,5 +305,12 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
Destination: &settings.Build.Labels,
Category: category,
},
&cli.StringFlag{
Name: "provenance",
EnvVars: []string{"PLUGIN_PROVENANCE"},
Usage: "generates provenance attestation for the build",
Destination: &settings.Build.Provenance,
Category: category,
},
}
}

View File

@ -131,6 +131,10 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd {
args = append(args, "--label", arg)
}
if build.Provenance != "" {
args = append(args, "--provenance", build.Provenance)
}
return exec.Command(dockerExe, args...)
}

View File

@ -63,6 +63,7 @@ type Build struct {
Output string // Docker build output folder
NamedContext cli.StringSlice // Docker build named context
Labels cli.StringSlice // Docker build labels
Provenance string // Docker build provenance attestation
}
// Settings for the Plugin.