Skip to content

Commit 4fcc111

Browse files
fix(release): compare host-less image refs on digest alone
hack/verify-promoted-packages.sh reported "promotion changed the container repository/digest set" for a v1.6.2 promotion that moved no container bytes at all: all 48 real repo@digest refs and all 48 digests were byte-identical between the rc artifact and the promotion candidate. The six entries it flagged as changed repositories were not repositories. They were bare tag strings -- v1.6.2-rc.1 on the rc side, v1.6.2 on the candidate side -- pairing one-to-one by identical digest. hack/lib/image-refs.sh emits two entries per shape-3 split map: the correctly joined repository@digest, plus shape 1's recursive scrape of the raw .tag scalar, which carries no repository. The library documents that degeneracy and leaves host-less refs to its callers; promote-retag.sh drops them, the verifier had only a */cozystack-packages exclusion. So `${image%:*}` -- a no-op on a string holding no colon -- handed the tag over as the repository, and promotion rewrites exactly those tags. Set an empty repository for a ref with no `/` ahead of its digest, so it compares on the digest, which is the whole container identity such a ref carries and the only part promotion must not move. Dropping these refs instead would be wrong rather than blunter: packages/system/kuberture carries an `image:` map with a `tag:` and no `repository:`, so shape 1 is the only rule that sees its digest, and skipping it would silently stop proving that digest unchanged. Reproduced over the release-1.6 packages tree with the shape-3 tags rewritten rc-to-stable: before, the six pairs above diverge; after, both sides normalize to 60 identical entries, kuberture's digest included and kube-ovn's real repository still visible through its shape-4 join. Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent eb11104 commit 4fcc111

1 file changed

Lines changed: 38 additions & 1 deletion

File tree

‎hack/verify-promoted-packages.sh‎

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,44 @@ normalized_refs() {
206206
digest="${raw##*@}"
207207
image="${without_digest##*/}"
208208
if [ "$without_digest" = "$image" ]; then
209-
repo="${image%:*}"
209+
# No `/` anywhere ahead of the digest, so nothing in this ref names a
210+
# registry host or a repository path — it is a bare scalar sitting in
211+
# front of a digest, and the collector emits those by design. Shape 3
212+
# (`repository:` on one key, `tag: <tag>@sha256:<digest>` on another) is
213+
# the dominant shape in the tree, and shape 1's recursive descent sees
214+
# that `tag` scalar on its own, so every shape-3 map arrives here twice:
215+
# once correctly joined, once as the bare tag. hack/lib/image-refs.sh
216+
# documents that degeneracy and leaves host-less refs to its callers —
217+
# promote-retag.sh drops them through its ownership filter, and this
218+
# function had no equivalent. `${image%:*}` is then a no-op (a tag holds
219+
# no colon) and the TAG arrives as the repository. Promotion rewrites
220+
# exactly those tags, which is how a promotion that moved no container
221+
# bytes at all reported six changed "repositories" whose digests were
222+
# identical on both sides.
223+
#
224+
# Compare such a ref on its digest alone. The digest is the whole of the
225+
# container identity a host-less ref carries, and it is the only part
226+
# promotion must not move; the empty repository yields a leading `@`,
227+
# which no real repository name can produce, so these cannot collide with
228+
# a host-bearing entry. Where a repository name does exist behind one of
229+
# them — kube-ovn's `global.images.kubeovn`, whose host lives in
230+
# `global.registry.address` — the same image also arrives host-bearing
231+
# from shape 4, so a repository change stays visible through that entry.
232+
#
233+
# Dropping host-less refs outright would be wrong rather than merely
234+
# blunter: packages/system/kuberture/values.yaml carries an `image:` map
235+
# with a `tag:` and no `repository:`, so shape 1 is the only rule that
236+
# ever sees its digest. Skipping it would silently stop proving that
237+
# digest is unchanged — a hole in the very guard this branch repairs.
238+
#
239+
# Do NOT reach for promote-retag.sh's `${REGISTRY}/` ownership filter to
240+
# do this job. The verify job's REGISTRY names the private build registry
241+
# while both artifacts under comparison live on the public one, so that
242+
# filter drops every ref; and the emptiness guard above tests the RAW
243+
# collection rather than the filtered set, so the proof would then pass
244+
# by comparing two empty sets — failing open on the one invariant it
245+
# exists to establish.
246+
repo=""
210247
else
211248
repo="${without_digest%/*}/${image%:*}"
212249
fi

0 commit comments

Comments
 (0)