From 70320e0abfac28bdbe48ada00753cfc96194f923 Mon Sep 17 00:00:00 2001 From: Myasnikov Daniil Date: Fri, 26 Jun 2026 20:40:02 +0500 Subject: [PATCH] fix(platform): stamp migrations 45/46 via the cozystack-version helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Migrations 45 and 46 (added by #2931) stamp the cozystack-version ConfigMap with an inline `kubectl apply` heredoc instead of sourcing lib/cozystack-version.sh and calling stamp_cozystack_version, the way 42/43/44 do. The cozystack-version-stamp.bats guard forbids any migration >= 42 from bypassing the helper, so `make bats-unit-tests` fails on migration 45. This only surfaces in PR CI (make unit-tests); main-push CI does not run the bats suite, so #2931 landed red on this test and now blocks every PR that merges current main. Route both stamps through the helper. The helper renders a byte-identical labeled manifest (golden-pinned in the bats suite), so this is behaviour- preserving — it just restores the no-label-drift guarantee the heredoc form could silently lose. Assisted-By: Claude Signed-off-by: Myasnikov Daniil --- .../platform/images/migrations/migrations/45 | 27 +++++++------------ .../platform/images/migrations/migrations/46 | 27 +++++++------------ 2 files changed, 18 insertions(+), 36 deletions(-) diff --git a/packages/core/platform/images/migrations/migrations/45 b/packages/core/platform/images/migrations/migrations/45 index 8081c8f2d..8b06dd2c4 100755 --- a/packages/core/platform/images/migrations/migrations/45 +++ b/packages/core/platform/images/migrations/migrations/45 @@ -39,6 +39,9 @@ set -euo pipefail +# shellcheck source=lib/cozystack-version.sh +. "$(dirname "$0")/lib/cozystack-version.sh" + DRY_RUN="${MIGRATION_DRY_RUN:-0}" FAILURES=0 PATCHED=0 @@ -118,21 +121,9 @@ if [ "$FAILURES" -gt 0 ]; then exit 1 fi -# Stamp version=46. Mirror migration 43's labeled heredoc — a label-less -# apply by the same field manager (kubectl create cm | kubectl apply) -# would strip the platform.cozystack.io/no-delete label migration 42 -# added, dropping cozystack-version out of the -# cozystack-no-delete-guardrail ValidatingAdmissionPolicy. -# templates/cozystack-version.yaml only re-renders the labeled ConfigMap -# on first install, so the label must be carried inline here. -kubectl apply --filename - </dev/null 2>&1 || true -# Stamp version=47. Mirror migration 43's labeled heredoc — a label-less -# apply by the same field manager (kubectl create cm | kubectl apply) -# would strip the platform.cozystack.io/no-delete label migration 42 -# added, dropping cozystack-version out of the -# cozystack-no-delete-guardrail ValidatingAdmissionPolicy. -# templates/cozystack-version.yaml only re-renders the labeled ConfigMap -# on first install, so the label must be carried inline here. -kubectl apply --filename - <