Skip to content

BAC-470 - Fail if Helm release exists in both v2 and v3#65

Open
churma wants to merge 2 commits intomasterfrom
BAC-470-detect-helm-dual-version-error
Open

BAC-470 - Fail if Helm release exists in both v2 and v3#65
churma wants to merge 2 commits intomasterfrom
BAC-470-detect-helm-dual-version-error

Conversation

@churma
Copy link
Contributor

@churma churma commented Jan 19, 2026

Summary

  • Checks both Helm v2 and v3 before proceeding with deployment
  • Fails with a clear error if the same release exists in both versions
  • Prevents invalid deployment states caused by duplicate releases

Jira Ticket

https://tiendanube.atlassian.net/browse/BAC-470

Test plan

  • Deploy a service that only exists in Helm v3 → should succeed
  • Deploy a service that only exists in Helm v2 → should succeed
  • Deploy a service that exists in both v2 and v3 → should fail with error message

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved Helm version detection to handle both v2 and v3 concurrently, surface per-version errors, and report conflicts when both are present.
  • Refactor

    • Split per-version result handling so each detected version produces its own manifest and chart metadata; final logic selects the appropriate version or defaults cleanly.
  • Documentation

    • Clarified messaging to show per-version outcomes and manifest paths.

✏️ Tip: You can customize this high-level summary in your review settings.

Check both Helm versions before proceeding. If the same release exists
in both Helm v2 and Helm v3, fail with an error message indicating the
invalid state that needs to be cleaned up.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Jan 19, 2026

Walkthrough

Refactored the Helm detection script to independently detect Helm v3 and v2 in parallel, capture per-version outcomes and manifests, add explicit cross-version conflict and non-not-found error handling, and expose per-version globals for chart names and backup manifest paths.

Changes

Cohort / File(s) Summary
Helm version detection script
src/scripts/detect_helm_version.sh
Detects v3 and v2 independently (parallel outcomes), adds CHART_NAME_V3 / CHART_NAME_V2 and BACKUP_MANIFEST_FILE_V3 / BACKUP_MANIFEST_FILE_V2 globals, records per-version manifests, treats non-not-found exit codes as errors, detects conflict when both versions found, and updates final decision flow for selecting helmv3/helmv2 or defaulting. (+47/−38 lines)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The description deviates from the required template structure. While it includes useful information about the changes and a Jira link, it lacks the required 'Why?' and 'What?' sections from the template. Restructure the description to follow the template: add a 'Why?' section explaining the rationale, use the 'What?' section for the summary, and keep the Jira link in 'Additional Links'.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly references the Jira ticket (BAC-470) and accurately summarizes the main change: failing when Helm releases exist in both v2 and v3.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/scripts/detect_helm_version.sh`:
- Around line 128-134: The detect_helmv3 and detect_helmv2 functions currently
toggle set -e which can cause the caller to exit before capturing their return
codes; modify each function to save the caller's errexit state at entry (e.g.
local _errexit_set=$(set -o | grep errexit) or inspect $- for 'e'), then safely
enable/disable errexit as needed inside the function, and finally restore the
original errexit state before returning so callers can reliably read the
function's exit code; alternatively remove internal toggling and let callers
control errexit—update detect_helmv3 and detect_helmv2 accordingly.

churma

This comment was marked as spam.

- Use separate backup manifest files for v2 and v3
- Use global variables CHART_NAME_V2 and CHART_NAME_V3
- Remove write_result from detect functions
- Centralize write_result call in detect_helm_version

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant