Skip to content

Commit df9dc74

Browse files
test(metallb): assert digest-pinned image form, not exact version literal (#2873)
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent c1aca89 commit df9dc74

1 file changed

Lines changed: 23 additions & 21 deletions

File tree

‎packages/system/metallb/tests/metallb_test.yaml‎

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -94,40 +94,42 @@ tests:
9494
- hasDocuments:
9595
count: 0
9696

97-
# The cozystack outer values.yaml pins .metallb.controller.image.tag and
98-
# .metallb.speaker.image.tag to a ghcr.io/cozystack/cozystack build that
99-
# MUST match the appVersion of the vendored chart. v0.16.0 introduced a
100-
# new probe contract (/healthz on port 17472) that earlier binaries don't
101-
# serve — a bump that lets these two drift produces CrashLoopBackOff pods
102-
# on the default branch between merge and the next release-prep commit.
103-
# The two assertions below pin the rendered image tag to the exact string
104-
# captured at chart appVersion v0.16.1; any in-place edit to values.yaml
105-
# (intentional or otherwise) without a matching test fixture refresh fails
106-
# CI before the change lands. Treat a failure here as "you edited
107-
# values.yaml; if the edit was intentional, run `make image` to push fresh
108-
# digests and update this fixture in the same commit". A future appVersion
109-
# bump in Chart.yaml requires updating both halves: `make image` writes
110-
# the new digest to values.yaml, then the fixture below is regenerated to
111-
# match — the test catches a forgotten regeneration as part of the bump.
112-
- it: pins controller image tag to the chart appVersion
97+
# The cozystack outer values.yaml pins the controller and speaker images to
98+
# a ghcr.io/cozystack/cozystack build addressed by digest. Do NOT pin the
99+
# exact version+digest literal here: release-prep re-stamps every image tag
100+
# to the platform version (e.g. v1.5.0-rc.2) and rebuilds the digest, so
101+
# neither half is stable across a release cut. An exact-literal assertion is
102+
# green on the default branch but breaks on every release branch — and that
103+
# breakage stays hidden until a release PR drops the `release` label, since
104+
# that label skips the Build job that runs `make unit-tests`.
105+
#
106+
# What MUST hold is weaker but real: the image is the cozystack-built
107+
# repository and is pinned by an @sha256 digest, never a floating tag. The
108+
# two assertions below enforce that form; the version string is left free on
109+
# purpose. A wrong repository (e.g. an upstream quay.io/metallb image) or a
110+
# tag with no digest still fails the suite. The probe-contract guarantee the
111+
# old literal was meant to provide actually comes from the build itself —
112+
# the image is built with `--build-arg VERSION=<appVersion>` — not from the
113+
# tag string rendered here.
114+
- it: pins the controller image to a digest-addressed cozystack build
113115
template: charts/metallb/templates/controller.yaml
114116
documentSelector:
115117
path: kind
116118
value: Deployment
117119
asserts:
118-
- equal:
120+
- matchRegex:
119121
path: spec.template.spec.containers[0].image
120-
value: ghcr.io/cozystack/cozystack/metallb-controller:v0.16.1@sha256:0d8d567780c0f1d487e15a5df2377c40f9c608a55f1a24581052c7c69eb4ccfd
122+
pattern: '^ghcr\.io/cozystack/cozystack/metallb-controller:[^@]+@sha256:[0-9a-f]{64}$'
121123

122-
- it: pins speaker image tag to the chart appVersion
124+
- it: pins the speaker image to a digest-addressed cozystack build
123125
template: charts/metallb/templates/speaker.yaml
124126
documentSelector:
125127
path: kind
126128
value: DaemonSet
127129
asserts:
128-
- equal:
130+
- matchRegex:
129131
path: spec.template.spec.containers[0].image
130-
value: ghcr.io/cozystack/cozystack/metallb-speaker:v0.16.1@sha256:aa16cee1c88923b67dbfcf69fe3e4dcb9a4ded95125a7f078752b4be240b5690
132+
pattern: '^ghcr\.io/cozystack/cozystack/metallb-speaker:[^@]+@sha256:[0-9a-f]{64}$'
131133

132134
# The values.yaml header comment documents that operators can revert the
133135
# speaker to legacy FRR mode by flipping these two keys. Pin both halves

0 commit comments

Comments
 (0)