fix(tests): keep two unit tests green after the release image restamp

The release build rewrites packages/*/values.yaml: the kube-ovn image tag
becomes the Cozystack version and the traces collector becomes the
first-party otelcol-tracing build. Two unit tests read exactly those
fields, so every PR against release-1.7 has failed Unit & controller
tests since the first rc.

The same patch applies to main as #5180.

Assisted-by: LLM
Signed-off-by: Marian Koreniuk <moriarti@cp.if.ua>
This commit is contained in:
Marian Koreniuk committed 2026-11-08 19:29:12 +01:00
1 parent a32334aeab
commit fcc1adaebb
2 files changed
+15 -6

No files matched your search

+7 -5
View File
@@ -22,7 +22,10 @@ extract_has() {
}
DOCKERFILE="$PWD/packages/system/multus/images/multus-cni/Dockerfile"
KUBEOVN_VALUES="$PWD/packages/system/kubeovn/values.yaml"
# The chart's appVersion, not the values.yaml image tag: a release build
# restamps that tag to the Cozystack version (v1.7.0), the chart keeps the
# kube-ovn release it vendors.
KUBEOVN_CHART="$PWD/packages/system/kubeovn/charts/kube-ovn/Chart.yaml"
DOC="$PWD/docs/vm-external-vlan.md"
PLATFORM_VALUES="$PWD/packages/core/platform/values.yaml"
TEMPLATE="$PWD/packages/system/multus/templates/multus-daemonset-thick.yml"
@@ -347,13 +350,12 @@ PATCHFILE="$PWD/packages/system/multus/patches/customize-deployment.patch"
checked=$(sed -n 's|^# kube-ovn-cni-plugins-checked-against: *\([^ ]*\) *$|\1|p' "$DOCKERFILE")
[ -n "$checked" ]
vendored=$(yq -r '.global.images.kubeovn.tag' "$KUBEOVN_VALUES" | sed 's|@.*||')
[ -n "$vendored" ]
[ "$vendored" != "null" ]
vendored=$(awk '$1 == "appVersion:" {gsub(/"/, "", $2); print "v" $2}' "$KUBEOVN_CHART")
[ "$vendored" != "v" ]
if [ "$checked" != "$vendored" ]; then
echo "the multus CNI plugin pin was checked against kube-ovn $checked," >&2
echo "but packages/system/kubeovn/values.yaml now vendors $vendored." >&2
echo "but packages/system/kubeovn/charts/kube-ovn/Chart.yaml now vendors $vendored." >&2
echo >&2
echo "Read CNI_PLUGINS_VERSION in kube-ovn $vendored's base image" >&2
echo "(dist/images/Dockerfile.base). If it still matches the" >&2
@@ -473,11 +473,18 @@ tests:
path: spec.template.spec.containers[0].securityContext.capabilities.drop
content: ALL
# The image name is not asserted: a release build swaps the upstream
# collector for the first-party otelcol-tracing one and restamps the tag.
# What must hold is that the value goes through cozy-lib.image (the cluster
# images-registry lands in front of it) and stays digest-pinned.
- it: pins the collector image through the cozy-lib.image helper
set:
_cluster:
images-registry: mirror.example.com
documentSelector:
path: kind
value: Deployment
asserts:
- matchRegex:
path: spec.template.spec.containers[0].image
pattern: "opentelemetry-collector-contrib:.*@sha256:"
pattern: '^mirror\.example\.com/.+@sha256:[0-9a-f]{64}$'