Skip to content

Commit 46329d5

Browse files
fetskoblink1073
andauthored
PYTHON-5141 Update SBOM usage for Kondukto (#73)
Co-authored-by: Steven Silvester <[email protected]>
1 parent 22d707f commit 46329d5

File tree

5 files changed

+62
-16
lines changed

5 files changed

+62
-16
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ This action will download an Augmented SBOM file in `$RELEASE_ASSETS/sbom.json`.
173173
- name: Create SBOM
174174
uses: mongodb-labs/drivers-github-tools/sbom@v2
175175
with:
176-
silk_asset_group: mongodb-python-driver
176+
sbom_in_path: sbom.json
177177
```
178178

179179
### Code Scanning Alerts
@@ -228,7 +228,7 @@ in the `S3_ASSETS` folder. This composite action runs the `authorized-pub`, `sbo
228228
with:
229229
product_name: winkerberos
230230
release_version: ${{ inputs.version }}
231-
silk_asset_group: winkerberos
231+
sbom_in_path: sbom.json
232232
dist_filenames: dist/*
233233
```
234234

full-report/action.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,16 @@ inputs:
99
required: true
1010
sarif_report_target_ref:
1111
description: The git ref (usually the target release branch) to pull sarif reports from.
12+
sbom_in_path:
13+
description: The path of the input sbom file.
14+
default: sbom.json
15+
kondukto_sub_project:
16+
description: The Kondukto sub-project name (appended to the branch name)
17+
required: false
1218
sbom_file_name:
1319
description: The name of the augmented sbom file.
1420
default: cyclonedx.sbom.json
21+
# No longer used.
1522
silk_asset_group:
1623
description: The Silk Asset Group for the Project
1724
third_party_dependency_tool:
@@ -40,11 +47,13 @@ runs:
4047
token: ${{ inputs.token }}
4148
- name: Generate SBOM File
4249
# not all packages have third party dependencies, and so not all packages integrate with silk.
43-
if: ${{ inputs.silk_asset_group }}
50+
if: ${{ inputs.silk_asset_group }} || ${{ inputs.sbom_in_path }}
4451
uses: mongodb-labs/drivers-github-tools/sbom@v2
4552
with:
4653
silk_asset_group: ${{ inputs.silk_asset_group }}
4754
sbom_file_name: ${{ inputs.sbom_file_name }}
55+
kondukto_sub_project: ${{ inputs.kondukto_sub_project }}
56+
sbom_in_path: ${{ inputs.sbom_in_path }}
4857
- name: Generate Sarif File
4958
uses: mongodb-labs/drivers-github-tools/code-scanning-export@v2
5059
with:

python/post-publish/action.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,16 @@ inputs:
1414
product_name:
1515
description: The name of the product
1616
required: true
17+
sbom_in_path:
18+
description: The path of the input sbom file.
19+
default: sbom.json
20+
kondukto_sub_project:
21+
description: The Kondukto sub-project name (appended to the branch name)
22+
required: false
23+
# No longer used.
1724
silk_asset_group:
1825
description: The Silk Asset Group for the Project
19-
required: true
26+
required: false
2027
evergreen_project:
2128
description: The evergreen project name.
2229
required: true
@@ -64,6 +71,8 @@ runs:
6471
release_version: ${{ inputs.version }}
6572
sarif_report_target_ref: ${{ inputs.version }}
6673
dist_filenames: dist/*
74+
kondukto_sub_project: ${{ inputs.kondukto_sub_project }}
75+
sbom_in_path: ${{ inputs.sbom_in_path }}
6776
silk_asset_group: ${{ inputs.silk_asset_group }}
6877
evergreen_project: ${{ inputs.evergreen_project }}
6978
evergreen_commit: ${{ steps.evergreen-commit.outputs.commit }}

sbom/action.yml

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,44 @@
1-
name: Download the Augmented SBOM
2-
description: Downloads the Augmented SBOM for the project
1+
name: Augment the SBOM
2+
description: Augments the SBOM for the project
33
inputs:
4-
silk_asset_group:
5-
description: The Silk Asset Group for the Project
6-
required: true
4+
sbom_in_path:
5+
description: The path of the input sbom file.
6+
default: sbom.json
77
sbom_file_name:
88
description: The name of the augmented sbom file.
99
default: cyclonedx.sbom.json
10+
kondukto_sub_project:
11+
description: The Kondukto sub-project name (appended to the branch name)
12+
required: false
1013
artifactory_image:
1114
description: Image to use for artifactory
12-
default: artifactory.corp.mongodb.com/release-tools-container-registry-public-local/silkbomb:1.0
15+
default: artifactory.corp.mongodb.com/release-tools-container-registry-public-local/silkbomb:2.0
16+
# no longer used
17+
silk_asset_group:
18+
description: The Silk Asset Group for the Project
19+
required: false
1320

1421
runs:
1522
using: composite
1623
steps:
17-
- name: Download the Augmented SBOM file to the release assets and s3 assets folders
24+
- name: Augments the SBOM file and writes it to the release assets and s3 assets folders
1825
shell: bash
26+
env:
27+
SBOM_IN_PATH: ${{ inputs.sbom_in_path }}
28+
KONDUKTO_SUB_PROJECT: ${{ inputs.kondukto_sub_project }}
29+
ARTIFACTORY_IMAGE: ${{ inputs.artifactory_image }}
30+
SBOM_FILE_NAME: ${{ inputs.sbom_file_name }}
1931
run: |
2032
set -eux
21-
podman run --platform="linux/amd64" -it --rm -v ${RELEASE_ASSETS}:/pwd \
22-
--env-file=${SILKBOMB_ENVFILE} \
23-
${{ inputs.artifactory_image }} \
24-
download --silk-asset-group ${{ inputs.silk_asset_group }} --sbom-out /pwd/cyclonedx.sbom.json
25-
cp ${RELEASE_ASSETS}/cyclonedx.sbom.json ${S3_ASSETS}/${{ inputs.sbom_file_name }}
33+
if [ -n "${KONDUKTO_SUB_PROJECT}" ]; then
34+
KONDUKTO_BRANCH="${GITHUB_REF_NAME}_${KONDUKTO_SUB_PROJECT}"
35+
else
36+
KONDUKTO_BRANCH="${GITHUB_REF_NAME}"
37+
fi
38+
echo "Generating SBOM file for ${KONDUKTO_BRANCH}..."
39+
podman run --platform="linux/amd64" -it --rm -v ${RELEASE_ASSETS}:/pwd -v $(pwd):/repo \
40+
--env-file=${KONDUKTO_ENVFILE} \
41+
${ARTIFACTORY_IMAGE} \
42+
augment --sbom-in /repo/${SBOM_IN_PATH} --repo ${GITHUB_REPOSITORY} --branch ${KONDUKTO_BRANCH} --sbom-out /pwd/cyclonedx.sbom.json
43+
cp ${RELEASE_ASSETS}/cyclonedx.sbom.json ${S3_ASSETS}/${SBOM_FILE_NAME}
44+
echo "Generating SBOM file for ${KONDUKTO_BRANCH}... done."

setup/setup.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ SILK_CLIENT_SECRET=${SILKBOMB_KEY}
3434
EOF
3535
fi
3636

37+
if [ -n "${KONDUKTO_TOKEN:-}" ]; then
38+
echo "Setting up envfile for Kondukto"
39+
KONDUKTO_ENVFILE=/tmp/kondukto-envfile
40+
cat << EOF > $KONDUKTO_ENVFILE
41+
KONDUKTO_TOKEN=${KONDUKTO_TOKEN}
42+
EOF
43+
fi
44+
3745
echo "Set up output directories"
3846
export RELEASE_ASSETS=/tmp/release-assets
3947
mkdir $RELEASE_ASSETS
@@ -48,6 +56,7 @@ GPG_KEY_ID=$GPG_KEY_ID
4856
GPG_PUBLIC_URL=${GPG_PUBLIC_URL:-}
4957
GARASIGN_ENVFILE=$GARASIGN_ENVFILE
5058
SILKBOMB_ENVFILE=${SILKBOMB_ENVFILE:-}
59+
KONDUKTO_ENVFILE=${KONDUKTO_ENVFILE:-}
5160
ARTIFACTORY_REGISTRY=$ARTIFACTORY_REGISTRY
5261
RELEASE_ASSETS=$RELEASE_ASSETS
5362
S3_ASSETS=$S3_ASSETS

0 commit comments

Comments
 (0)