feat: add option to configure provenance attestation

This commit is contained in:
Robert Kaussow 2023-01-12 11:20:30 +01:00
parent 59df27455c
commit 5c4f783c2f
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
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.