Skip to content

GODRIVER-3599: Add task script to generate CycloneDX SBOM #2119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,14 @@ tasks:
binary: bash
args: [*task-runner, check-fmt, check-license, check-modules, lint]

- name: generate-sbom
tags: ["ssdlc"]
commands:
- command: subprocess.exec
params:
binary: bash
args: [*task-runner, generate-sbom]

- name: pull-request-helpers
allowed_requesters: ["patch", "github_pr"]
commands:
Expand Down
13 changes: 13 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,19 @@ tasks:

update-notices: bash etc/generate_notices.pl > THIRD-PARTY-NOTICES

generate-sbom:
desc: Generate a CycloneDX SBOM
summary: |
The cyclonedx-gomod 'mod' subcommand is used to generate a CycloneDX SBOM with GOWORK=off to exclude example/test code.
The SBOM includes the aggregate of modules required by packages in the mongo-go-driver library, excluding examples, tests and test packages.
Task will run only when go.mod is newer than sbom.cdx.json.
TODO: Add libmongocrypt as an optional component via a merge once the libmongocrypt SBOM is updated with newer automation
method: timestamp
sources: [go.mod]
generates: [sbom.cdx.json]
cmd: |
GOWORK=off go run github.com/CycloneDX/cyclonedx-gomod/cmd/[email protected] mod -type library -licenses -assert-licenses -output-version 1.5 -json -output sbom.cdx.json .

### Local testing tasks. ###
test: go test ${BUILD_TAGS} -timeout {{.TEST_TIMEOUT}}s -p 1 ./...

Expand Down
4 changes: 4 additions & 0 deletions etc/generate-sbom.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -eux

task generate-sbom
Loading