Skip to content

Commit 9044d23

Browse files
committed
Initial test
1 parent e2f1531 commit 9044d23

File tree

3 files changed

+110
-9
lines changed

3 files changed

+110
-9
lines changed
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Augment SBOM
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
inputs:
7+
release_version:
8+
description: "Release version (e.g. 1.42.2)"
9+
required: true
10+
type: string
11+
12+
permissions:
13+
id-token: write
14+
contents: read
15+
16+
jobs:
17+
augment-sbom:
18+
runs-on: ubuntu-latest
19+
20+
env:
21+
KONDUKTO_TOKEN: ${{ secrets.KONDUKTO_TOKEN }}
22+
KONDUKTO_REPO: mongodb/mongodb-atlas-cli
23+
KONDUKTO_BRANCH_PREFIX: atlascli
24+
SILKBOMB_IMG: artifactory.corp.mongodb.com/release-tools-container-registry-public-local/silkbomb:2.0
25+
26+
steps:
27+
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
28+
with:
29+
config: ${{ vars.PERMISSIONS_CONFIG }}
30+
- name: Checkout repo
31+
uses: actions/checkout@v4
32+
33+
- uses: actions/setup-go@v5
34+
with:
35+
go-version-file: 'go.mod'
36+
37+
- name: Download Linux ARM64 binary
38+
run: |
39+
curl -L "https://github.com/mongodb/mongodb-atlas-cli/releases/download/atlascli%2Fv${{ inputs.release_version || '1.42.2' }}/mongodb-atlas-cli_${{ github.event.inputs.release_version || '1.42.2' }}_linux_arm64.tar.gz" \
40+
-o release.tar.gz
41+
42+
- name: Extract binary
43+
run: |
44+
tar -xzf release.tar.gz
45+
46+
- name: Generate PURLs from binary
47+
run: |
48+
go version -m ./mongodb-atlas-cli_${{ inputs.release_version || '1.42.2' }}_linux_arm64/bin/atlas | \
49+
awk '$1 == "dep" || $1 == "=>" { print "pkg:golang/" $2 "@" $3 }' | \
50+
LC_ALL=C sort > purls.txt
51+
cat purls.txt
52+
53+
- name: Generate SBOM with Silkbomb
54+
run: |
55+
docker run \
56+
--pull=always \
57+
--platform="linux/amd64" \
58+
--rm \
59+
-v "${PWD}:/pwd" \
60+
"${SILKBOMB_IMG}" \
61+
update \
62+
--purls "/pwd/purls.txt" \
63+
--sbom-out "/pwd/sbom_lite.json"
64+
cat "sbom_lite.json"
65+
66+
- name: Augment SBOM with Kondukto
67+
run: |
68+
docker run \
69+
--pull=always \
70+
--platform="linux/amd64" \
71+
--rm \
72+
-v "${PWD}:/pwd" \
73+
-e "KONDUKTO_TOKEN=${KONDUKTO_TOKEN}" \
74+
"${SILKBOMB_IMG}" \
75+
augment \
76+
--sbom-in "/pwd/sbom_lite.json" \
77+
--repo "${KONDUKTO_REPO}" \
78+
--branch "${KONDUKTO_BRANCH_PREFIX}-linux-arm64" \
79+
--sbom-out "/pwd/linux_amd64_augmented_sbom_v${{ inputs.release_version || '1.42.2' }}.json"
80+
81+
- name: Generate SSDLC report
82+
env:
83+
AUTHOR: ${{ github.actor }}
84+
VERSION: ${{ inputs.release_version || '1.42.2' }}
85+
AUGMENTED_SBOM_TEXT: " - See Augmented SBOM manifests (CycloneDX in JSON format):
86+
\n - This file has been provided along with this report under the name 'linux_amd64_augmented_sbom_v${{ inputs.release_version || '1.42.2' }}.json'\n"
87+
run: ./build/package/gen-ssdlc-report.sh
88+
- name: Upload augmented SBOM as artifact
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: augmented_sbom_and_ssdlc_report
92+
path: |
93+
linux_amd64_augmented_sbom_v${{ inputs.release_version || '1.42.2' }}.json
94+
ssdlc-compliance-${{ inputs.release_version || '1.42.2' }}.md

build/package/gen-ssdlc-report.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ set -eu
1919
release_date=${DATE:-$(date -u '+%Y-%m-%d')}
2020

2121
export DATE="${release_date}"
22+
export AUGMENTED_SBOM_TEXT=${AUGMENTED_SBOM_TEXT:-""}
2223

2324
if [ -z "${AUTHOR:-}" ]; then
2425
AUTHOR=$(git config user.name)
@@ -31,16 +32,22 @@ fi
3132
export AUTHOR
3233
export VERSION
3334

34-
echo "Generating SSDLC checklist for AtlasCLI version ${VERSION}, author ${AUTHOR} and release date ${DATE}..."
35+
target_dir="."
36+
37+
if [ -z "${AUGMENTED_SBOM_TEXT:-}" ]; then
38+
target_dir="compliance/v${VERSION}"
3539

36-
# Ensure AtlasCLI version directory exists
37-
mkdir -p "compliance/v${VERSION}"
40+
# Ensure AtlasCLI version directory exists
41+
mkdir -p "${target_dir}"
42+
fi
43+
44+
echo "Generating SSDLC checklist for AtlasCLI version ${VERSION}, author ${AUTHOR} and release date ${DATE}..."
3845

3946
envsubst < docs/releases/ssdlc-compliance.template.md \
40-
> "compliance/v${VERSION}/ssdlc-compliance-${VERSION}.md"
47+
> "${target_dir}/ssdlc-compliance-${VERSION}.md"
4148

42-
echo "SDLC checklist ready. Files in compliance/v${VERSION}/:"
43-
ls -l "compliance/v${VERSION}/"
49+
echo "SDLC checklist ready. Files in ${target_dir}/:"
50+
ls -l "${target_dir}/"
4451

4552
echo "Printing the generated report:"
46-
cat "compliance/v${VERSION}/ssdlc-compliance-${VERSION}.md"
53+
cat "${target_dir}/ssdlc-compliance-${VERSION}.md"

docs/releases/ssdlc-compliance.template.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Overview:
1818
- **Dependency Information**
1919
- See SBOM Lite manifests (CycloneDX in JSON format):
2020
- https://github.com/mongodb/mongodb-atlas-cli/releases/download/atlascli%2Fv${VERSION}/sbom.json
21-
21+
${AUGMENTED_SBOM_TEXT}
2222
- **Security Testing Report**
2323
- Available as needed from Cloud Security.
2424

@@ -27,4 +27,4 @@ Overview:
2727

2828
Assumptions and attestations:
2929

30-
- Internal processes are used to ensure CVEs are identified and mitigated within SLAs.
30+
- Internal processes are used to ensure CVEs are identified and mitigated within SLAs.

0 commit comments

Comments
 (0)