|
| 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 |
0 commit comments