fix(platform): stamp migrations 45/46 via the cozystack-version helper#3118
Conversation
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 <noreply@anthropic.com> Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request standardizes how platform versions are stamped during migrations 45 and 46. By replacing manual heredoc applications with the established 'cozystack-version' helper, the changes ensure consistency with existing migration patterns and satisfy the requirements of the unit test suite, which was previously failing due to non-compliant implementation. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on Gemini (@gemini-code-assist) comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughTwo platform migration scripts now source a shared version-stamping helper and use it to update the ChangesPlatform migration stamping
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request refactors migration scripts 45 and 46 by sourcing a shared helper script lib/cozystack-version.sh and replacing the inline kubectl apply heredocs with the stamp_cozystack_version helper function. This change reduces duplication and ensures consistent stamping of the cozystack-version ConfigMap. No review comments were provided, and there is no additional feedback.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Aleksei Sviridkin (lexfrei)
left a comment
There was a problem hiding this comment.
LGTM — a clean, behavior-preserving refactor.
Migrations 45 and 46 now stamp the version through the shared stamp_cozystack_version helper instead of an inline labeled heredoc. I verified the helper (migrations/lib/cozystack-version.sh, present on main) renders an identical manifest — ConfigMap cozystack-version in ${NAMESPACE:-cozy-system}, the platform.cozystack.io/no-delete: "true" label, and version: "<n>" as a quoted string — and applies it via kubectl apply --filename -, so the output matches what the heredocs produced. The stamped versions are preserved (45 stamps 46, 46 stamps 47), the source path $(dirname "$0")/lib/cozystack-version.sh is correct, and the helper's manifest is itself pinned by hack/cozystack-version-stamp.bats. This is exactly the anti-drift intent — centralizing the labeled manifest so a migration can't silently regress to a label-less apply that would strip the no-delete label and drop cozystack-version out of the no-delete guardrail.
Non-blocking:
- #2936 (open) also modifies migration 45, so whichever lands second will need a rebase; if this PR is the intended home for the stamp refactor, that one can drop its migration-45 stamp change.
- FYI, out of scope: migrations 45/46 only run once
migrations.targetVersionis bumped (>= 46 / >= 47) — main is at 45 — so this refactor takes effect when the activating change lands.
Approving.
What this PR does
Migrations 45 and 46 (added by #2931) stamp the
cozystack-versionConfigMapwith an inline
kubectl applyheredoc instead of sourcinglib/cozystack-version.shand callingstamp_cozystack_version, the waymigrations 42/43/44 do. The
cozystack-version-stamp.batsguard forbids anymigration ≥42 from bypassing the helper, so
make bats-unit-testsfails onmigration 45.
This only surfaces in PR CI (
make unit-tests) —main-push CI does not runthe bats suite — so #2931 landed red on this test and now blocks every PR that
merges current
main.This routes both stamps through the helper. The helper renders a
byte-identical labeled manifest (golden-pinned in the bats suite), so the
change is behaviour-preserving: it just restores the no-label-drift guarantee
the heredoc form could silently lose.
Verified:
make bats-unit-testspasses (was failing on migration 45), bashsyntax-check clean on both scripts.
Summary by CodeRabbit
Bug Fixes
Chores