-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
#14559) * chore: Generate SLSA provenance for SBOM (#14438) (#14507) * Add provenance generation for sbom Signed-off-by: Noah Elzner <[email protected]> * upload SBOM Signed-off-by: Noah Elzner <[email protected]> * Remove cosign setup Signed-off-by: Noah Elzner <[email protected]> * include hashes in generate-sbom output Signed-off-by: Noah Elzner <[email protected]> * Replace Cosign Verification command with SLSA command in docs Signed-off-by: Noah Elzner <[email protected]> * Remove id-token write permission - no longer needed Signed-off-by: Noah Elzner <[email protected]> --------- Signed-off-by: Noah Elzner <[email protected]> Signed-off-by: Noah Elzner <[email protected]> * change source tag in sbom verification command to v2.8.0 Signed-off-by: Noah Elzner <[email protected]> --------- Signed-off-by: Noah Elzner <[email protected]> Signed-off-by: Noah Elzner <[email protected]>
- Loading branch information
Showing
2 changed files
with
33 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,7 +95,7 @@ jobs: | |
args: release --clean --timeout 55m | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
KUBECTL_VERSION: ${{ env.KUBECTL_VERSION }} | ||
KUBECTL_VERSION: ${{ env.KUBECTL_VERSION }} | ||
GIT_TREE_STATE: ${{ env.GIT_TREE_STATE }} | ||
|
||
- name: Generate subject for provenance | ||
|
@@ -127,13 +127,14 @@ jobs: | |
upload-assets: true | ||
|
||
generate-sbom: | ||
name: Create Sbom and sign assets | ||
name: Create SBOM and generate hash | ||
needs: | ||
- argocd-image | ||
- goreleaser | ||
permissions: | ||
contents: write # Needed for release uploads | ||
id-token: write # Needed for signing Sbom | ||
outputs: | ||
hashes: ${{ steps.sbom-hash.outputs.hashes}} | ||
if: github.repository == 'argoproj/argo-cd' | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
|
@@ -148,11 +149,6 @@ jobs: | |
with: | ||
go-version: ${{ env.GOLANG_VERSION }} | ||
|
||
- name: Install cosign | ||
uses: sigstore/cosign-installer@d13028333d784fcc802b67ec924bcebe75aa0a5f # v3.1.0 | ||
with: | ||
cosign-release: 'v2.0.0' | ||
|
||
- name: Generate SBOM (spdx) | ||
id: spdx-builder | ||
env: | ||
|
@@ -183,21 +179,36 @@ jobs: | |
cd /tmp && tar -zcf sbom.tar.gz *.spdx | ||
- name: Sign SBOM | ||
- name: Generate SBOM hash | ||
shell: bash | ||
id: sbom-hash | ||
run: | | ||
cosign sign-blob \ | ||
--output-certificate=/tmp/sbom.tar.gz.pem \ | ||
--output-signature=/tmp/sbom.tar.gz.sig \ | ||
-y \ | ||
/tmp/sbom.tar.gz | ||
# sha256sum generates sha256 hash for sbom. | ||
# base64 -w0 encodes to base64 and outputs on a single line. | ||
# sha256sum /tmp/sbom.tar.gz ... | base64 -w0 | ||
echo "hashes=$(sha256sum /tmp/sbom.tar.gz | base64 -w0)" >> "$GITHUB_OUTPUT" | ||
- name: Upload SBOM and signature assets | ||
- name: Upload SBOM | ||
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
files: | | ||
/tmp/sbom.tar.* | ||
/tmp/sbom.tar.gz | ||
sbom-provenance: | ||
needs: [generate-sbom] | ||
permissions: | ||
actions: read # for detecting the Github Actions environment | ||
id-token: write # Needed for provenance signing and ID | ||
contents: write # Needed for release uploads | ||
if: github.repository == 'argoproj/argo-cd' | ||
# Must be refernced by a tag. https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#referencing-the-slsa-generator | ||
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected] | ||
with: | ||
base64-subjects: "${{ needs.generate-sbom.outputs.hashes }}" | ||
provenance-name: "argocd-sbom.intoto.jsonl" | ||
upload-assets: true | ||
|
||
post-release: | ||
needs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters