Skip to content

Commit 1ee01fc

Browse files
blink1073alcaeus
andauthored
Add SBOM handling action (#13)
Co-authored-by: Andreas Braun <[email protected]>
1 parent 7db6064 commit 1ee01fc

File tree

4 files changed

+54
-2
lines changed

4 files changed

+54
-2
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,22 @@ It will create the file `$S3_ASSETS/authorized_publication.txt`
116116
token: ${{ github.token }}
117117
```
118118

119+
### Software Bill of Materials (SBOM)
120+
121+
This action will download an Augmented SBOM file in `$RELEASE_ASSETS/sbom.json`.
122+
123+
```yaml
124+
- name: Setup
125+
uses: mongodb-labs/drivers-github-tools/setup@v2
126+
with:
127+
...
128+
129+
- name: Create SBOM
130+
uses: mongodb-labs/drivers-github-tools/sbom@v2
131+
with:
132+
silk_asset_group: mongodb-python-driver
133+
```
134+
119135
## Python Helper Scripts
120136

121137
These scripts are opinionated helper scripts for Python releases.

python/publish/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ inputs:
1414
product_name:
1515
description: "The name of the product"
1616
required: true
17+
silk_asset_group:
18+
description: The Silk Asset Group for the Project
19+
required: true
1720
token:
1821
description: "The GitHub access token"
1922
required: true
@@ -42,6 +45,9 @@ runs:
4245
release_version: ${{ inputs.version }}
4346
filenames: dist/*
4447
token: ${{ inputs.token }}
48+
- uses: mongodb-labs/drivers-github-tools/sbom@v2
49+
with:
50+
silk_asset_group: ${{ inputs.silk_asset_group }}
4551
- name: Generate Sarif Report
4652
uses: mongodb-labs/drivers-github-tools/code-scanning-export@v2
4753
with:

sbom/action.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Download the Augmented SBOM
2+
description: Downloads the Augmented SBOM for the project
3+
inputs:
4+
silk_asset_group:
5+
description: The Silk Asset Group for the Project
6+
required: true
7+
artifactory_image:
8+
description: Image to use for artifactory
9+
default: artifactory.corp.mongodb.com/release-tools-container-registry-public-local/silkbomb:1.0
10+
11+
runs:
12+
using: composite
13+
steps:
14+
- name: Download the Augmented SBOM file to the release assets folder
15+
shell: bash
16+
run: |
17+
podman run --platform="linux/amd64" -it --rm -v ${RELEASE_ASSETS}:/pwd \
18+
--env-file=${SILKBOMB_ENVFILE} \
19+
${{ inputs.artifactory_image }} \
20+
download --silk-asset-group ${{ inputs.silk_asset_group }} --sbom-out /pwd/sbom.json

setup/setup.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,22 @@ echo "::group::Set up artifactory"
1414
echo $ARTIFACTORY_PASSWORD | podman login -u $ARTIFACTORY_USERNAME --password-stdin $ARTIFACTORY_REGISTRY
1515
echo "::endgroup::"
1616

17-
echo "Set up envfile for artifactory image"
18-
GARASIGN_ENVFILE=/tmp/envfile
17+
echo "Set up envfile for garasign"
18+
GARASIGN_ENVFILE=/tmp/garasign-envfile
1919
cat << EOF > $GARASIGN_ENVFILE
2020
GRS_CONFIG_USER1_USERNAME=$GARASIGN_USERNAME
2121
GRS_CONFIG_USER1_PASSWORD=$GARASIGN_PASSWORD
2222
EOF
2323

24+
if [ -n "${SILKBOMB_USER:-}" ]; then
25+
echo "Set up envfile for silkbomb"
26+
SILKBOMB_ENVFILE=/tmp/silkbomb-envfile
27+
cat << EOF > $SILKBOMB_ENVFILE
28+
SILK_CLIENT_ID=${SILKBOMB_USER}
29+
SILK_CLIENT_SECRET=${SILKBOMB_KEY}
30+
EOF
31+
fi
32+
2433
echo "Set up output directories"
2534
export RELEASE_ASSETS=/tmp/release-assets
2635
mkdir $RELEASE_ASSETS
@@ -34,6 +43,7 @@ AWS_BUCKET=${RELEASE_ASSETS_BUCKET:-}"
3443
GPG_KEY_ID=$GPG_KEY_ID
3544
GPG_PUBLIC_URL=${GPG_PUBLIC_URL:-}"
3645
GARASIGN_ENVFILE=$GARASIGN_ENVFILE
46+
SILKBOMB_ENVFILE=$SILKBOMB_ENVFILE
3747
ARTIFACTORY_REGISTRY=$ARTIFACTORY_REGISTRY
3848
RELEASE_ASSETS=$RELEASE_ASSETS
3949
S3_ASSETS=$S3_ASSETS

0 commit comments

Comments
 (0)