-
Notifications
You must be signed in to change notification settings - Fork 16
feat(ci): binary attestation with SLSA Build Provenance v1 #194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8803882
feat: attestation in goreleaser
lockwobr f3daa53
feat: attestation in goreleaser
lockwobr 3a88aeb
feat: move dep code to action
lockwobr c466ecd
docs: add docs for cli attestation
lockwobr 8e247ff
Merge branch 'main' into worktree-bundle-attestation
lockwobr 4389bc5
Merge branch 'main' into worktree-bundle-attestation
mchmarny 0598434
Merge branch 'main' into worktree-bundle-attestation
mchmarny d357bac
fix: added minor change to address pr feedback
lockwobr 3953766
Merge branch 'main' into worktree-bundle-attestation
mchmarny e12ed03
fix: added minor change to address pr feedback
lockwobr e4ec34f
Merge branch 'main' into worktree-bundle-attestation
mchmarny File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| name: 'Generate SLSA Predicate' | ||
| description: 'Generate a SLSA Build Provenance v1 predicate JSON for cosign attest-blob' | ||
|
|
||
| inputs: | ||
| workflow_file: | ||
| description: 'Workflow filename for builder ID (e.g., on-tag.yaml)' | ||
| required: true | ||
|
|
||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Generate SLSA predicate | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| PREDICATE="${RUNNER_TEMP}/slsa-predicate.json" | ||
| cat > "$PREDICATE" <<-EOF | ||
| { | ||
| "buildDefinition": { | ||
| "buildType": "https://aicr.nvidia.com/binary/v1", | ||
| "externalParameters": { | ||
| "repository": "${{ github.repository }}", | ||
| "ref": "${{ github.ref }}" | ||
| }, | ||
| "resolvedDependencies": [{ | ||
| "uri": "git+https://github.com/${{ github.repository }}@${{ github.ref }}", | ||
| "digest": { "gitCommit": "${{ github.sha }}" } | ||
| }] | ||
| }, | ||
| "runDetails": { | ||
| "builder": { | ||
| "id": "https://github.com/${{ github.repository }}/.github/workflows/${{ inputs.workflow_file }}" | ||
| }, | ||
| "metadata": { | ||
| "invocationId": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
| } | ||
| } | ||
| } | ||
| EOF | ||
| echo "SLSA_PREDICATE=${PREDICATE}" >> "$GITHUB_ENV" |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| # Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # Build attested binaries on-demand without cutting a release tag. | ||
| # Produces tar.gz archives with SLSA Build Provenance v1 attestation | ||
| # as downloadable job artifacts. | ||
|
|
||
| ## NOTE: THIS WORKFLOW IS FOR TESTING PURPOSES ONLY. | ||
| ## if you need something attested by ci. This does not run tests or security scans. | ||
| ## The only complete/valid way to attest that passes all validation is via on-tag.yaml. | ||
| ## Validate attestations requires to pass the following certificate identity regexp: | ||
| ## --certificate-identity-regexp 'https://github.com/NVIDIA/aicr/.github/workflows/on-tag\.yaml@refs/tags/.*' | ||
| ## so this attestation is not the same as a production release. | ||
|
|
||
| name: Build Attested Binaries | ||
|
|
||
| on: | ||
| workflow_dispatch: {} | ||
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
|
||
| jobs: | ||
| build-and-attest: | ||
| needs: [tests, security-scan] | ||
| name: Build and Attest Binaries | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 | ||
| with: | ||
| go-version-file: go.mod | ||
| cache: true | ||
|
|
||
| - name: Install Cosign | ||
| uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0 | ||
|
|
||
| - name: Install GoReleaser | ||
| uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 | ||
| with: | ||
| install-only: true | ||
|
|
||
| - name: Generate SLSA predicate | ||
| uses: ./.github/actions/generate-slsa-predicate | ||
| with: | ||
| workflow_file: build-attested.yaml | ||
|
|
||
| - name: Build and attest | ||
| env: | ||
| GOFLAGS: -mod=vendor | ||
| run: | | ||
| set -euo pipefail | ||
| goreleaser release --snapshot --clean --skip=publish,ko,sbom --timeout 10m | ||
|
|
||
| - name: Verify archive contents | ||
| run: | | ||
| set -euo pipefail | ||
| echo "=== Archives ===" | ||
| ls -la dist/aicr_v*.tar.gz 2>/dev/null || echo "No archives found" | ||
| echo "" | ||
| for archive in dist/aicr_v*.tar.gz; do | ||
| [ -f "$archive" ] || continue | ||
| echo "--- $(basename "$archive") ---" | ||
| tar -tzf "$archive" | ||
| echo "" | ||
| done | ||
|
|
||
| - name: Upload archives | ||
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | ||
| with: | ||
| name: aicr-attested-binaries | ||
| path: dist/*.tar.gz | ||
| retention-days: 3 | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.