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

Commit cf1e48b

Browse files
authored
feat: add support for SBOM attestation (#217)
Signed-off-by: Paulo Gomes <[email protected]>
1 parent a1837cc commit cf1e48b

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
@@ -260,3 +260,8 @@ properties:
260260
description: Generate [provenance](https://docs.docker.com/build/attestations/slsa-provenance/) attestation for the build (shorthand for `--attest=type=provenance`).
261261
type: string
262262
required: false
263+
264+
- name: sbom
265+
description: Generate [sbom](https://docs.docker.com/build/attestations/sbom/) attestation for the build (shorthand for `--attest type=sbom`).
266+
type: string
267+
required: false

cmd/drone-docker-buildx/config.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,5 +314,12 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
314314
Destination: &settings.Build.Provenance,
315315
Category: category,
316316
},
317+
&cli.StringFlag{
318+
Name: "sbom",
319+
EnvVars: []string{"PLUGIN_SBOM"},
320+
Usage: "generates sbom attestation for the build",
321+
Destination: &settings.Build.SBOM,
322+
Category: category,
323+
},
317324
}
318325
}

plugin/docker.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ func commandBuild(build Build, dryrun bool) *execabs.Cmd {
156156
args = append(args, "--provenance", build.Provenance)
157157
}
158158

159+
if build.SBOM != "" {
160+
args = append(args, "--sbom", build.SBOM)
161+
}
162+
159163
return execabs.Command(dockerBin, args...)
160164
}
161165

plugin/impl.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ type Build struct {
6464
NamedContext cli.StringSlice // Docker build named context
6565
Labels cli.StringSlice // Docker build labels
6666
Provenance string // Docker build provenance attestation
67+
SBOM string // Docker build sbom attestation
6768
}
6869

6970
// Settings for the Plugin.

0 commit comments

Comments
 (0)