Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.

Commit 13e353b

Browse files
authored
feat: add option to configure provenance attestation (#171)
1 parent 6278d55 commit 13e353b

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

_docs/data/data.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,3 +255,8 @@ properties:
255255
description: Labels to add to the image.
256256
type: list
257257
required: false
258+
259+
- name: provenance
260+
description: Generate [provenance](https://docs.docker.com/build/attestations/slsa-provenance/) attestation for the build (shorthand for `--attest=type=provenance`).
261+
type: string
262+
required: false

cmd/drone-docker-buildx/config.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,5 +305,12 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
305305
Destination: &settings.Build.Labels,
306306
Category: category,
307307
},
308+
&cli.StringFlag{
309+
Name: "provenance",
310+
EnvVars: []string{"PLUGIN_PROVENANCE"},
311+
Usage: "generates provenance attestation for the build",
312+
Destination: &settings.Build.Provenance,
313+
Category: category,
314+
},
308315
}
309316
}

plugin/docker.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd {
131131
args = append(args, "--label", arg)
132132
}
133133

134+
if build.Provenance != "" {
135+
args = append(args, "--provenance", build.Provenance)
136+
}
137+
134138
return exec.Command(dockerExe, args...)
135139
}
136140

plugin/impl.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ type Build struct {
6363
Output string // Docker build output folder
6464
NamedContext cli.StringSlice // Docker build named context
6565
Labels cli.StringSlice // Docker build labels
66+
Provenance string // Docker build provenance attestation
6667
}
6768

6869
// Settings for the Plugin.

0 commit comments

Comments
 (0)