Skip to content

Commit 766e24b

Browse files
oarbusiCopilot
andauthored
chore: Augment SBOM on demand (#1368)
Co-authored-by: Copilot <[email protected]>
1 parent a4115ca commit 766e24b

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Augment SBOM
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_version:
7+
description: "Release version (e.g. 1.35.1)"
8+
required: true
9+
type: string
10+
resource:
11+
description: "Resource name (e.g. organization, project, etc.)"
12+
required: true
13+
type: string
14+
15+
16+
permissions:
17+
id-token: write
18+
contents: read
19+
20+
jobs:
21+
augment-sbom:
22+
runs-on: ubuntu-latest
23+
24+
env:
25+
KONDUKTO_TOKEN: ${{ secrets.KONDUKTO_TOKEN }}
26+
KONDUKTO_REPO: ${{ vars.KONDUKTO_REPO }}
27+
KONDUKTO_BRANCH_PREFIX: ${{ vars.KONDUKTO_BRANCH_PREFIX }}
28+
SILKBOMB_IMG: ${{ vars.SILKBOMB_IMG }}
29+
30+
steps:
31+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
32+
33+
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
34+
with:
35+
go-version-file: 'go.mod'
36+
37+
- name: Get current date
38+
id: date
39+
run: |
40+
echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
41+
42+
- name: Augment SBOM with Kondukto
43+
env:
44+
RELEASE_VERSION: ${{ inputs.release_version }}
45+
RESOURCE: ${{ inputs.resource }}
46+
run: |
47+
make augment-sbom
48+
49+
- name: Generate SSDLC report
50+
env:
51+
AUTHOR: ${{ github.actor }}
52+
VERSION: ${{ inputs.release_version }}
53+
AUGMENTED_REPORT: "true"
54+
run: ./scripts/gen-ssdlc-report.sh
55+
56+
- name: Upload augmented SBOM as artifact
57+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
58+
with:
59+
name: augmented_sbom_and_ssdlc_report
60+
path: |
61+
cfn-resources/${{ inputs.resource }}/compliance/augmented-sbom-v${{ inputs.release_version }}-${{ steps.date.outputs.date }}.json
62+
cfn-resources/${{ inputs.resource }}/compliance/ssdlc-compliance-${{ inputs.release_version }}-${{ steps.date.outputs.date }}.md
63+
if-no-files-found: error

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,7 @@ gen-sbom-and-ssdlc-report:
6969
./scripts/generate-sbom.sh $(RESOURCE) $(VERSION)
7070
./scripts/gen-ssdlc-report.sh $(RESOURCE) $(VERSION)
7171
./scripts/upload-sbom.sh $(RESOURCE) $(VERSION)
72+
73+
.PHONY: augment-sbom
74+
augment-sbom:
75+
./scripts/augment-sbom.sh $(RESOURCE) $(VERSION)

scripts/augment-sbom.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
: "${RELEASE_VERSION:?RELEASE_VERSION environment variable not set}"
5+
: "${RESOURCE:?RESOURCE environment variable not set}"
6+
DATE="${DATE:-$(date +'%Y-%m-%d')}"
7+
8+
echo "Augmenting SBOM..."
9+
docker run \
10+
--pull=always \
11+
--platform="linux/amd64" \
12+
--rm \
13+
-v "${PWD}:/pwd" \
14+
-e KONDUKTO_TOKEN \
15+
"$SILKBOMB_IMG" \
16+
augment \
17+
--sbom-in "/pwd/cfn-resources/${RESOURCE}/compliance/v${RELEASE_VERSION}/sbom.json" \
18+
--repo "$KONDUKTO_REPO" \
19+
--branch "$KONDUKTO_BRANCH_PREFIX-linux-arm64" \
20+
--sbom-out "/pwd/cfn-resources/${RESOURCE}/compliance/augmented-sbom-v${RELEASE_VERSION}-${DATE}.json"

0 commit comments

Comments
 (0)