Skip to content

Commit 895b30f

Browse files
committed
fix(ci): read a suffixed image key as a ref, not a config change
A chart that renders more than one image names the extra ones after what they are for, so packages/system/backupstrategy-controller/values.yaml carries chBackupClientImage, rabbitmqBackupClientImage and redisBackupClientImage beside its own image key. The overlay's classifier matched a key only when it was exactly image/repository/registry/tag/digest, so those three passed solely through the `@sha256:` branch. redisBackupClientImage is pinned by tag alone. It therefore read as a config change, and one such line costs the WHOLE file its overlay: the package kept its committed release ref in every lane that did not rebuild it, and served an image from v1.6.0 (22 July) against a tree carrying four backup strategy drivers added after it. Five of the seven chainsaw failures behind #4257 trace to that, across three unrelated pull requests. Accept a prefix before image in the key branch. The trailing colon keeps it narrow: imagePullPolicy and imagePullSecrets are still config, because the key has to end at image. Assisted-by: LLM Signed-off-by: IvanHunters <[email protected]>
1 parent eee43d9 commit 895b30f

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

‎hack/overlay-main-images.sh‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,17 @@ skip=" packages/core/talos packages/core/installer $(echo "$BUILT_JSON" | tr -d
7777

7878
# A changed line is image-reference-bearing if it carries a full ref (@sha256:),
7979
# is a split ref key (image/repository/registry/tag/digest), or a `--…-image=` arg.
80-
img_line='(@sha256:|^[[:space:]]*(- )?(image|repository|registry|tag|digest):|--[A-Za-z-]*image=)'
80+
#
81+
# The key match accepts a prefix before `image` because a chart that renders
82+
# several images names the extra ones after what they are for —
83+
# chBackupClientImage, rabbitmqBackupClientImage, redisBackupClientImage. Those
84+
# used to pass only through the `@sha256:` branch, so one pinned by tag alone
85+
# read as a config change and cost its WHOLE file the overlay: that is how
86+
# backupstrategy-controller kept serving a release image two months older than
87+
# the tree in every lane that did not rebuild it (#4257). The trailing `:` is
88+
# what keeps this narrow — `imagePullPolicy:` and `imagePullSecrets:` still do
89+
# not match, because the key has to END at `image`.
90+
img_line='(@sha256:|^[[:space:]]*(- )?([A-Za-z]*[Ii]mage|repository|registry|tag|digest):|--[A-Za-z-]*image=)'
8191

8292
overlaid=0
8393
same=0

‎hack/overlay-main-images_test.bats‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,22 @@
223223
# the tree under review. That used to be one line among hundreds, so three
224224
# separate PRs each spent a round establishing that a red backup suite was not
225225
# theirs (#4257).
226+
# A ref whose key merely ENDS in Image, and which carries no digest to fall back
227+
# on, used to read as a config change and cost its whole file the overlay. That
228+
# is how backupstrategy-controller ran a release image two months older than the
229+
# tree in every lane that did not rebuild it (#4257): one such line sat beside
230+
# digest-pinned siblings the classifier did recognise.
231+
@test "a suffixed image key is a ref, not a config change" {
232+
root=$(pwd)
233+
w=$(mktemp -d); trap 'rm -rf "$w"' EXIT
234+
mkdir -p "$w/packages/system/gamma" "$w/main/system/gamma"
235+
printf 'gamma:\n image: "ghcr.io/cozystack/cozystack/gamma:v1.6.0@sha256:aaaa"\n clientImage: "ghcr.io/cozystack/cozystack/client:v1.6.0"\n' > "$w/packages/system/gamma/values.yaml"
236+
printf 'gamma:\n image: "iad.ocir.io/x/cozystack/gamma:main@sha256:cccc"\n clientImage: "iad.ocir.io/x/cozystack/client:main"\n' > "$w/main/system/gamma/values.yaml"
237+
( cd "$w" && "$root/hack/overlay-main-images.sh" main '[]' ) > "$w/out.txt"
238+
grep -q 'overlay: packages/system/gamma/values.yaml' "$w/out.txt"
239+
grep -q 'iad.ocir.io/x/cozystack/client:main' "$w/packages/system/gamma/values.yaml"
240+
}
241+
226242
@test "drift is summarised as a GitHub annotation naming the packages" {
227243
root=$(pwd)
228244
w=$(mktemp -d); trap 'rm -rf "$w"' EXIT

0 commit comments

Comments
 (0)