-
Notifications
You must be signed in to change notification settings - Fork 29
build: track Makefile Go tool pins in a nested tools module #294
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
Draft
asivanadi0
wants to merge
3
commits into
NVIDIA:main
Choose a base branch
from
asivanadi0:cursor/tools-go-dependabot-pins-17d0
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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,30 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Single source for the verifier-side cosign/crane pins: the workflow_call | ||
| # defaults (and crane digest) already documented on attest.yml. Dependabot | ||
| # cannot raise those defaults; see .github/dependabot.yml. | ||
|
|
||
| name: Read attest.yml tool pins | ||
| description: > | ||
| Read the cosign and crane pins from attest.yml so verifier jobs use the | ||
| same versions the signer documents. | ||
|
|
||
| outputs: | ||
| cosign_version: | ||
| description: workflow_call default for cosign_version | ||
| value: ${{ steps.read.outputs.cosign_version }} | ||
| crane_version: | ||
| description: workflow_call default for crane_version | ||
| value: ${{ steps.read.outputs.crane_version }} | ||
| crane_sha256: | ||
| description: CRANE_SHA256 next to the crane install in attest.yml | ||
| value: ${{ steps.read.outputs.crane_sha256 }} | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - id: read | ||
| name: Parse attest.yml defaults | ||
| shell: bash | ||
| run: python3 "${GITHUB_ACTION_PATH}/read.py" |
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,87 @@ | ||
| #!/usr/bin/env python3 | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| """Emit the signer tool pins from attest.yml. | ||
|
|
||
| Verifier jobs (release.yml verify-release, docs-verify.yml) must consume these | ||
| values rather than carrying their own copies. Dependabot cannot raise | ||
| workflow_call input defaults; reading the file is how the copies stay one pin. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import os | ||
| import re | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| VERSION_RE = re.compile(r"^v[0-9]+\.[0-9]+\.[0-9]+$") | ||
| SHA256_RE = re.compile(r"^[0-9a-f]{64}$") | ||
|
|
||
|
|
||
| def attest_path() -> Path: | ||
| here = Path(__file__).resolve() | ||
| # .github/actions/read-attest-pins/read.py -> .github/workflows/attest.yml | ||
| bundled = here.parents[2] / "workflows" / "attest.yml" | ||
| candidates = [bundled] | ||
| workspace = os.environ.get("GITHUB_WORKSPACE") | ||
| if workspace: | ||
| candidates.append(Path(workspace) / ".github/workflows/attest.yml") | ||
| candidates.append(Path(".github/workflows/attest.yml")) | ||
| for path in candidates: | ||
| if path.is_file(): | ||
| return path | ||
| raise SystemExit( | ||
| "could not find .github/workflows/attest.yml; looked in: " | ||
| + ", ".join(str(p) for p in candidates) | ||
| ) | ||
|
|
||
|
|
||
| def input_default(text: str, name: str) -> str: | ||
| # workflow_call inputs are indented six spaces; their fields, eight. | ||
| # The job-output assignment `cosign_version: ${{ ... }}` has no `default:`. | ||
| match = re.search( | ||
| rf"(?m)^ {re.escape(name)}:\n(?: .*\n)*? default: ['\"]([^'\"]+)['\"]", | ||
| text, | ||
| ) | ||
| if not match: | ||
| raise SystemExit(f"could not find workflow_call default for {name}") | ||
| return match.group(1) | ||
|
|
||
|
|
||
| def crane_sha256(text: str) -> str: | ||
| match = re.search(r"(?m)^ CRANE_SHA256: ([0-9a-f]{64})$", text) | ||
| if not match: | ||
| raise SystemExit("could not find CRANE_SHA256 in attest.yml") | ||
| return match.group(1) | ||
|
|
||
|
|
||
| def emit(key: str, value: str) -> None: | ||
| line = f"{key}={value}" | ||
| print(line) | ||
| output = os.environ.get("GITHUB_OUTPUT") | ||
| if output: | ||
| with open(output, "a", encoding="utf-8") as handle: | ||
| handle.write(line + "\n") | ||
|
|
||
|
|
||
| def main() -> int: | ||
| path = attest_path() | ||
| text = path.read_text(encoding="utf-8") | ||
| cosign = input_default(text, "cosign_version") | ||
| crane = input_default(text, "crane_version") | ||
| digest = crane_sha256(text) | ||
| if not VERSION_RE.match(cosign): | ||
| raise SystemExit(f"cosign_version {cosign!r} is not vMAJOR.MINOR.PATCH") | ||
| if not VERSION_RE.match(crane): | ||
| raise SystemExit(f"crane_version {crane!r} is not vMAJOR.MINOR.PATCH") | ||
| if not SHA256_RE.match(digest): | ||
| raise SystemExit("CRANE_SHA256 is not a 64-char lowercase hex digest") | ||
| emit("cosign_version", cosign) | ||
| emit("crane_version", crane) | ||
| emit("crane_sha256", digest) | ||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| sys.exit(main()) |
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,19 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Helm CLI pin for ci.yml, release.yml, and uat.yml. Dependabot's | ||
| # github-actions ecosystem updates the setup-helm action SHA below; it does | ||
| # not touch `version:`. Bump that input here — one place — during release | ||
| # prep. See .github/dependabot.yml. | ||
|
|
||
| name: Setup Helm | ||
| description: > | ||
| Install the pinned Helm CLI. The CLI version is a manual pin (Dependabot | ||
| only updates the setup-helm action SHA). | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1 | ||
| with: | ||
| version: v3.19.2 |
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The manual-pin list is not the full surface #279 asked to track. Dependabot's
github-actionsecosystem updatesuses:SHAs only. These values are on this branch and will not move:COSIGN_VERSIONinrelease.yml(verify-releaseenv, passed tocosign-installerascosign-release). This is the workflowenv:pin the issue named. It leftpublish.yml, and it is still an env value.cosign-release: v3.1.3as a literalwith:input indocs-verify.yml.CRANE_VERSION+CRANE_SHA256indocs-verify.yml. Same digest-pair constraint as crane inattest.ymland as syft, in a second copy.version: v3.19.2onazure/setup-helminci.yml,release.yml, anduat.yml(twice on currentmain).attest.yml's defaults are the signer.release.ymlanddocs-verify.ymlare the verifiers. Bumping only the documented default leaves verification on a different cosign or crane. The Helm CLI pin can drift the same way across those three workflows.Minimum correction: add each pin to this list with the reason it stays manual. For cosign and crane, better to have the verifier jobs read the same default
attest.ymlalready documents, so there is one pin.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 5d68e84.
Cosign / crane — unified (preferred path):
attest.ymlremains the single pin (workflow_calldefaults +CRANE_SHA256).release.ymlverify-releaseanddocs-verify.ymlnow read those values via.github/actions/read-attest-pins, so there is no secondCOSIGN_VERSION, no literalcosign-release: v3.1.3, and no duplicate crane digest pair on the verifiers.Helm CLI — centralized:
ci.yml,release.yml, anduat.ymlinstall through.github/actions/setup-helm. Dependabot still moves theazure/setup-helmSHA; the CLIversion:input lives in one place.Manual-pin list:
.github/dependabot.ymlnow documents the full #279 surface you named (attest.yml cosign/crane and that verifiers consume it, Helmversion:insetup-helm, plus the existing GitHub-release / digest pins) with why each stays manual.test/releasepolicy/tool_pins_test.gofails if a verifier re-embeds those versions, if helm is called beside the composite action, or if a pin drops off the dependabot comment.