Skip to content

fix(platform): stamp migrations 45/46 via the cozystack-version helper#3118

Merged
Aleksei Sviridkin (lexfrei) merged 1 commit into
mainfrom
fix/migrations-stamp-helper
Jun 26, 2026
Merged

fix(platform): stamp migrations 45/46 via the cozystack-version helper#3118
Aleksei Sviridkin (lexfrei) merged 1 commit into
mainfrom
fix/migrations-stamp-helper

Conversation

@myasnikovdaniil

@myasnikovdaniil myasnikovdaniil commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

What this PR does

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
migrations 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.

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-tests passes (was failing on migration 45), bash
syntax-check clean on both scripts.

NONE

Summary by CodeRabbit

  • Bug Fixes

    • Improved platform version stamping to keep the version record correctly labeled and consistent during upgrades.
    • Updated tenant Kubernetes resources to move from v1.30 to v1.31 as part of the migration flow.
  • Chores

    • Standardized migration behavior by using a shared version-stamping helper for more reliable updates.

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>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • Migration Helper Integration: Updated migrations 45 and 46 to utilize the 'stamp_cozystack_version' helper function instead of manual heredoc 'kubectl apply' calls.
  • CI Test Resolution: Resolved 'cozystack-version-stamp.bats' failures by ensuring migrations adhere to the required helper usage, fixing the broken CI pipeline.
  • Behavior Preservation: Maintained byte-identical manifest labeling by routing through the shared helper, preventing potential label drift.
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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment Gemini (@gemini-code-assist) Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions Bot added area/platform Issues or PRs related to platform infrastructure (bundle, flux, talos, installer) kind/bug Categorizes issue or PR as related to a bug size/M This PR changes 30-99 lines, ignoring generated files labels Jun 26, 2026
@dosubot dosubot Bot added the area/testing Issues or PRs related to testing (e2e, bats, unit tests) label Jun 26, 2026
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b9b0e348-ff1a-433c-b818-a18e4383d147

📥 Commits

Reviewing files that changed from the base of the PR and between f4a000e and 70320e0.

📒 Files selected for processing (2)
  • packages/core/platform/images/migrations/migrations/45
  • packages/core/platform/images/migrations/migrations/46

📝 Walkthrough

Walkthrough

Two platform migration scripts now source a shared version-stamping helper and use it to update the cozystack-version ConfigMap instead of inline kubectl apply heredocs.

Changes

Platform migration stamping

Layer / File(s) Summary
Shared helper import
packages/core/platform/images/migrations/migrations/45, packages/core/platform/images/migrations/migrations/46
Both migration scripts source lib/cozystack-version.sh before running version-stamping logic.
ConfigMap stamp calls
packages/core/platform/images/migrations/migrations/45, packages/core/platform/images/migrations/migrations/46
Both migration scripts replace inline kubectl apply heredocs with stamp_cozystack_version calls for versions 46 and 47.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • cozystack/cozystack#2980: Also switches migration scripts from inline kubectl apply stamping to stamp_cozystack_version helpers.

Suggested labels

kind/cleanup

Suggested reviewers

  • kvaps
  • IvanHunters

Poem

A rabbit hopped through migration night,
With helper paws and version light.
Two stamps now land with tidy grace,
On ConfigMaps in their place.
🐇✨ Hop, hop, version right!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: migrations 45 and 46 now stamp cozystack-version through the shared helper.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/migrations-stamp-helper

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.targetVersion is bumped (>= 46 / >= 47) — main is at 45 — so this refactor takes effect when the activating change lands.

Approving.

@lexfrei Aleksei Sviridkin (lexfrei) merged commit 4752161 into main Jun 26, 2026
13 checks passed
@lexfrei Aleksei Sviridkin (lexfrei) deleted the fix/migrations-stamp-helper branch June 26, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/platform Issues or PRs related to platform infrastructure (bundle, flux, talos, installer) area/testing Issues or PRs related to testing (e2e, bats, unit tests) kind/bug Categorizes issue or PR as related to a bug size/M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants