Skip to content

The agent that grows with you

fix(release): give the Nix release build its commit and push Docker images under the attempt ref

Teknium818c13be1dc4
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index c404f9be694..4f8207c97fa 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -25,7 +25,7 @@ on:
type: string
default: ''
tag:
- description: "Exact stable tag (vX.Y.Z) under release. The caller is dispatched on this tag, so github.sha is the release candidate."
+ description: "Attempt ref (rc.N-vX.Y.Z) under release; the versioned images carry this tag. The caller is dispatched on it, so github.sha is the release candidate."
required: false
type: string
default: ''
diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml
index bf568cce3c1..8a2a65fad67 100644
--- a/.github/workflows/nix.yml
+++ b/.github/workflows/nix.yml
@@ -152,14 +152,17 @@ jobs:
- name: nix flake check
# --print-build-logs: a check that fails then prints the assertion
# that failed, and not only the derivation that failed to build.
- run: nix flake check "${{ inputs.release == true && format('path:{0}/release-source', runner.temp) || '.' }}" --print-build-logs
+ # A path: flake has no git metadata, so the release source names its
+ # commit with ?rev=: without it self.rev is null, the install stamp
+ # carries no commit, and the packaged CLI reports "unknown".
+ run: nix flake check "${{ inputs.release == true && format('path:{0}/release-source?rev={1}', runner.temp, github.sha) || '.' }}" --print-build-logs
- name: Verify release package runtime identity
if: inputs.release == true
env:
RELEASE_VERSION: ${{ inputs.version }}
run: |
- source="path:$RUNNER_TEMP/release-source"
+ source="path:$RUNNER_TEMP/release-source?rev=$GITHUB_SHA"
package="$(nix build "$source#default" --no-link --print-out-paths)"
actual="$("$package/bin/hermes" --version)"
ACTUAL_VERSION="$actual" python3 - <<'PY'
diff --git a/.github/workflows/stable-release.yml b/.github/workflows/stable-release.yml
index 727f9ac72e8..e8cbcd24b4d 100644
--- a/.github/workflows/stable-release.yml
+++ b/.github/workflows/stable-release.yml
@@ -87,7 +87,7 @@ jobs:
with:
release-phase: test
skip-tests: ${{ needs.admit.outputs.skip-tests == 'true' }}
- tag: ${{ needs.admit.outputs.tag }}
+ tag: ${{ needs.admit.outputs.claim-tag }}
version: ${{ needs.admit.outputs.version }}
nix:
@@ -523,7 +523,7 @@ jobs:
secrets: inherit
with:
release-phase: publish
- tag: ${{ needs.admit.outputs.tag }}
+ tag: ${{ needs.admit.outputs.claim-tag }}
version: ${{ needs.admit.outputs.version }}
publish-bundles:
diff --git a/tests/ci/test_stable_release_graph.py b/tests/ci/test_stable_release_graph.py
index 1ed2997c4c5..86bd0206cf1 100644
--- a/tests/ci/test_stable_release_graph.py
+++ b/tests/ci/test_stable_release_graph.py
@@ -247,6 +247,19 @@ def test_release_gates_extract_consumer_facing_versions():
)
assert '"$package/bin/hermes" --version' in nix_check
assert "actual != expected" in nix_check
+ # A path: flake has no git metadata; without ?rev= the stamp has no commit
+ # and the packaged CLI reports "unknown".
+ assert 'release-source?rev=$GITHUB_SHA' in nix_check
+ flake_check = next(step["run"] for step in nix["flake-check"]["steps"] if step.get("name") == "nix flake check")
+ assert "release-source?rev={1}" in flake_check and "github.sha" in flake_check
+
+
+def test_versioned_docker_images_belong_to_one_attempt():
+ # The final vX.Y.Z does not exist until publish; a second attempt pushing
+ # under it collides with the first attempt's immutable manifest list.
+ jobs = workflow("stable-release.yml")["jobs"]
+ for name in ("docker", "publish-docker"):
+ assert jobs[name]["with"]["tag"] == "${{ needs.admit.outputs.claim-tag }}"
def test_packaged_stamp_writers_receive_versions_without_rewriting_python_metadata():