Skip to content

Commit 77e5fe3

Browse files
committed
Merge branch 'master' into chore_remove_msi_task
2 parents ecec996 + c6609e9 commit 77e5fe3

File tree

7 files changed

+133
-34
lines changed

7 files changed

+133
-34
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Augment SBOM
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_version:
7+
description: "Release version (e.g. 1.42.2)"
8+
required: true
9+
type: string
10+
11+
permissions:
12+
id-token: write
13+
contents: read
14+
15+
jobs:
16+
augment-sbom:
17+
runs-on: ubuntu-latest
18+
19+
env:
20+
KONDUKTO_TOKEN: ${{ secrets.KONDUKTO_TOKEN }}
21+
KONDUKTO_REPO: ${{ vars.KONDUKTO_REPO }}
22+
KONDUKTO_BRANCH_PREFIX: ${{ vars.KONDUKTO_BRANCH_PREFIX }}
23+
SILKBOMB_IMG: ${{ vars.SILKBOMB_IMG }}
24+
25+
steps:
26+
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
27+
with:
28+
config: ${{ vars.PERMISSIONS_CONFIG }}
29+
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 }}/mongodb-atlas-cli_${{ inputs.release_version }}_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 }}_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: Get current date
67+
id: date
68+
run: |
69+
echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_ENV"
70+
71+
- name: Augment SBOM with Kondukto
72+
run: |
73+
docker run \
74+
--pull=always \
75+
--platform="linux/amd64" \
76+
--rm \
77+
-v "${PWD}:/pwd" \
78+
-e "KONDUKTO_TOKEN=${KONDUKTO_TOKEN}" \
79+
"${SILKBOMB_IMG}" \
80+
augment \
81+
--sbom-in "/pwd/sbom_lite.json" \
82+
--repo "${KONDUKTO_REPO}" \
83+
--branch "${KONDUKTO_BRANCH_PREFIX}-linux-arm64" \
84+
--sbom-out "/pwd/linux-amd64-augmented-sbom-v${{ inputs.release_version }}-${{ env.date }}.json"
85+
86+
- name: Generate SSDLC report
87+
env:
88+
AUTHOR: ${{ github.actor }}
89+
VERSION: ${{ inputs.release_version }}
90+
AUGMENTED_REPORT: "true"
91+
run: ./build/package/gen-ssdlc-report.sh
92+
93+
- name: Upload augmented SBOM as artifact
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: augmented_sbom_and_ssdlc_report
97+
path: |
98+
linux-amd64-augmented-sbom-v${{ inputs.release_version }}-${{ env.date }}.json
99+
ssdlc-compliance-${{ inputs.release_version }}-${{ env.date }}.md
100+
if-no-files-found: error

.github/workflows/update-ssdlc-report.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
env:
3939
AUTHOR: ${{ steps.extract.outputs.author }}
4040
VERSION: ${{ steps.extract.outputs.version }}
41+
AUGMENTED_REPORT: "false"
4142
run: ./build/package/gen-ssdlc-report.sh
4243
- name: set Apix Bot token
4344
id: app-token

build/ci/release.yml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@ functions:
9696
params:
9797
shell: bash
9898
script: |
99-
docker run \
99+
podman run \
100100
--pull=always \
101101
--platform="linux/amd64" \
102102
--rm \
103103
--env-file ${workdir}/kondukto_credentials.env \
104104
-v ${workdir}:/workdir \
105105
901841024863.dkr.ecr.us-east-1.amazonaws.com/release-infrastructure/silkbomb:2.0 \
106106
upload \
107-
--sbom-in /workdir/src/github.com/mongodb/mongodb-atlas-cli/compliance/sbom.json \
107+
--sbom-in /workdir/src/github.com/mongodb/mongodb-atlas-cli/sbom.json \
108108
--repo mongodb_mongodb-atlas-cli \
109109
--branch ${branch_name}
110110
rm ${workdir}/kondukto_credentials.env
@@ -218,6 +218,7 @@ functions:
218218
- src/github.com/mongodb/mongodb-atlas-cli/dist/*.json
219219
- src/github.com/mongodb/mongodb-atlas-cli/dist/*.msi
220220
- src/github.com/mongodb/mongodb-atlas-cli/dist/*.sig
221+
- src/github.com/mongodb/mongodb-atlas-cli/sbom.json
221222
remote_file: ${project}/dist/${revision}_${created_at}/
222223
bucket: mongodb-mongocli-build
223224
permissions: public-read
@@ -349,17 +350,15 @@ functions:
349350
echo "${__project_aws_ssh_key_value}" > ./build/ci/ssh_id
350351
chmod 0600 ./build/ci/ssh_id
351352
tasks:
352-
- name: generate_and_upload_sbom
353-
commands:
354-
- func: "generate sbom"
355-
- func: "run silkbomb"
356353
- name: package_goreleaser
357354
tags: ["packaging"]
358355
depends_on:
359356
- name: compile
360357
variant: "code_health"
361358
commands:
362359
- func: "create-windows-host"
360+
- func: "generate sbom"
361+
- func: "run silkbomb"
363362
- func: "generate notices"
364363
- func: "install goreleaser"
365364
- func: "install macos notarization service"
@@ -506,9 +505,6 @@ buildvariants:
506505
unstable: -unstable
507506
tasks:
508507
- name: package_goreleaser
509-
depends_on:
510-
- name: generate_and_upload_sbom
511-
variant: ssdlc
512508
- name: publish_atlascli_snapshot
513509
display_name: "Publish AtlasCLI Snapshot"
514510
run_on:
@@ -531,9 +527,6 @@ buildvariants:
531527
meta_package_name: "mongodb-atlas"
532528
tasks:
533529
- name: package_goreleaser
534-
depends_on:
535-
- name: generate_and_upload_sbom
536-
variant: ssdlc
537530
- name: copybara
538531
display_name: "Copybara"
539532
git_tag_only: true
@@ -575,11 +568,3 @@ buildvariants:
575568
- ubuntu2004-small
576569
tasks:
577570
- name: .smoke-test .generate .repo .atlascli
578-
- name: ssdlc
579-
display_name: Compliance [ssdlc]
580-
run_on:
581-
- ubuntu2204-small
582-
expansions:
583-
<<: *go_linux_version
584-
tasks:
585-
- name: generate_and_upload_sbom

build/package/.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,5 @@ release:
145145
name_template: "MongoDB Atlas CLI {{.Version}}"
146146
extra_files:
147147
- glob: ./bin/*.msi
148-
- glob: compliance/**/*
148+
- glob: ./sbom.json
149149
version: 2

build/package/gen-ssdlc-report.sh

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,33 @@ if [ -z "${VERSION:-}" ]; then
2828
VERSION=$(git tag --list 'atlascli/v*' --sort=-taggerdate | head -1 | cut -d 'v' -f 2)
2929
fi
3030

31+
if [ "${AUGMENTED_REPORT}" = "true" ]; then
32+
target_dir="."
33+
file_name="ssdlc-compliance-${VERSION}-${DATE}.md"
34+
SBOM_TEXT=" - See Augmented SBOM manifests (CycloneDX in JSON format):
35+
- This file has been provided along with this report under the name 'linux_amd64_augmented_sbom_v${VERSION}.json'
36+
- Please note that this file was generated on ${DATE} and may not reflect the latest security information of all third party dependencies."
37+
38+
else # If not augmented, generate the standard report
39+
target_dir="compliance/v${VERSION}"
40+
file_name="ssdlc-compliance-${VERSION}.md"
41+
SBOM_TEXT=" - See SBOM Lite manifests (CycloneDX in JSON format):
42+
- https://github.com/mongodb/mongodb-atlas-cli/releases/download/atlascli%2Fv${VERSION}/sbom.json"
43+
# Ensure AtlasCLI version directory exists
44+
mkdir -p "${target_dir}"
45+
fi
46+
3147
export AUTHOR
3248
export VERSION
49+
export SBOM_TEXT
3350

3451
echo "Generating SSDLC checklist for AtlasCLI version ${VERSION}, author ${AUTHOR} and release date ${DATE}..."
3552

36-
# Ensure AtlasCLI version directory exists
37-
mkdir -p "compliance/v${VERSION}"
38-
3953
envsubst < docs/releases/ssdlc-compliance.template.md \
40-
> "compliance/v${VERSION}/ssdlc-compliance-${VERSION}.md"
54+
> "${target_dir}/${file_name}"
4155

42-
echo "SDLC checklist ready. Files in compliance/v${VERSION}/:"
43-
ls -l "compliance/v${VERSION}/"
56+
echo "SDLC checklist ready. Files in ${target_dir}/:"
57+
ls -l "${target_dir}/"
4458

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

build/package/generate-sbom.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ set -Eeou pipefail
1919
export WORKDIR=${workdir:?}
2020

2121
# Authenticate Docker to AWS ECR
22-
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 901841024863.dkr.ecr.us-east-1.amazonaws.com
22+
aws ecr get-login-password --region us-east-1 | podman login --username AWS --password-stdin 901841024863.dkr.ecr.us-east-1.amazonaws.com
2323

2424
echo "Generating SBOMs..."
25-
docker run --rm \
25+
podman run --rm \
2626
-v "$WORKDIR/src/github.com/mongodb/mongodb-atlas-cli:/pwd" \
2727
901841024863.dkr.ecr.us-east-1.amazonaws.com/release-infrastructure/silkbomb:2.0 \
2828
update \
2929
--purls /pwd/build/package/purls.txt \
30-
--sbom-out /pwd/compliance/sbom.json
30+
--sbom-out /pwd/sbom.json
3131

docs/releases/ssdlc-compliance.template.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ Overview:
1616
- [Kondukto](https://arcticglow.kondukto.io/)
1717

1818
- **Dependency Information**
19-
- See SBOM Lite manifests (CycloneDX in JSON format):
20-
- https://github.com/mongodb/mongodb-atlas-cli/releases/download/atlascli%2Fv${VERSION}/sbom.json
19+
${SBOM_TEXT}
2120

2221
- **Security Testing Report**
2322
- Available as needed from Cloud Security.
@@ -27,4 +26,4 @@ Overview:
2726

2827
Assumptions and attestations:
2928

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

0 commit comments

Comments
 (0)