Skip to content

Commit 319553c

Browse files
ci(release): pin nightly source artifact to a digest
Address review feedback from coderabbitai on .github/workflows/nightly.yaml: the resolve step read cozystack-packages:main and the pull step re-fetched the mutable :main tag, so a concurrent build-main push could check out commit A while mirroring tree B. Resolve the :main digest once, derive the revision sha from it, and pull the baked tree by that same digest. Assisted-By: Claude <[email protected]> Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 9f82616 commit 319553c

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

‎.github/workflows/nightly.yaml‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
outputs:
4949
version: ${{ steps.resolve.outputs.version }}
5050
sha: ${{ steps.resolve.outputs.sha }}
51+
packages_ref: ${{ steps.resolve.outputs.packages_ref }}
5152
packages_digest: ${{ steps.publish.outputs.packages_digest }}
5253
steps:
5354
- name: Set up toolchain (skopeo, flux, yq, helm)
@@ -80,7 +81,12 @@ jobs:
8081
id: resolve
8182
run: |
8283
set -eu
83-
rev="$(skopeo inspect --raw "docker://${SRC_REGISTRY}/cozystack-packages:main" \
84+
# Pin :main to its current digest first, then read the revision
85+
# annotation and pull the baked tree from that SAME digest below, so a
86+
# concurrent build-main push of :main cannot make us check out commit A
87+
# while mirroring tree B.
88+
packages_ref="$(skopeo inspect --format '{{.Digest}}' "docker://${SRC_REGISTRY}/cozystack-packages:main")"
89+
rev="$(skopeo inspect --raw "docker://${SRC_REGISTRY}/cozystack-packages@${packages_ref}" \
8490
| yq -r '.annotations["org.opencontainers.image.revision"] // ""' -p json 2>/dev/null || true)"
8591
# revision is "<git-describe>:<sha>"; take the sha.
8692
sha="${rev##*:}"
@@ -90,9 +96,10 @@ jobs:
9096
echo "$sha" | grep -qE '^[0-9a-f]{40}$' \
9197
|| { echo "::error::source revision '$sha' is not a 40-hex commit sha"; exit 1; }
9298
version="0.0.0-nightly.$(date -u +%Y%m%d)"
93-
echo "sha=$sha" >> "$GITHUB_OUTPUT"
94-
echo "version=$version" >> "$GITHUB_OUTPUT"
95-
echo "Resolved main build: sha=$sha version=$version"
99+
echo "sha=$sha" >> "$GITHUB_OUTPUT"
100+
echo "version=$version" >> "$GITHUB_OUTPUT"
101+
echo "packages_ref=$packages_ref" >> "$GITHUB_OUTPUT"
102+
echo "Resolved main build: sha=$sha version=$version packages_ref=$packages_ref"
96103
97104
- name: Checkout source commit
98105
uses: actions/checkout@v4
@@ -101,8 +108,9 @@ jobs:
101108
fetch-depth: 1
102109

103110
# Pull the digest-vendored tree build-main baked (but never committed).
111+
# Pinned to the digest resolved above, not the mutable :main tag.
104112
- name: Pull baked package tree
105-
run: flux pull artifact "oci://${SRC_REGISTRY}/cozystack-packages:main" --output _baked
113+
run: flux pull artifact "oci://${SRC_REGISTRY}/cozystack-packages@${{ steps.resolve.outputs.packages_ref }}" --output _baked
106114

107115
# Copy every cozystack-owned component image OCIR -> GHCR by digest and
108116
# rewrite the baked tree's image hosts to GHCR (digests untouched).

0 commit comments

Comments
 (0)