[minor] Handle Upgrade Retry with --next-channel Argument#2103
Merged
[minor] Handle Upgrade Retry with --next-channel Argument#2103
Conversation
whitfiea
requested changes
Mar 19, 2026
whitfiea
approved these changes
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for retrying MAS upgrades when the core has already been upgraded but applications are stuck on an older channel. It introduces a new --next-channel optional argument to the mas upgrade command that allows users to explicitly specify the target MAS channel.
Changes Made
--next-channel <channel># Optional: Target MAS channel to upgrade toAdded channel validation logic
Implemented retry scenario detection
Added app compatibility validation
Enhanced masChannel parameter handling for ansible-devops
5 comprehensive test scenarios covering all use cases
All tests passing ✅
Pseudo Logic
Use Cases & Examples
Use Case 1: Normal Upgrade (No --next-channel)
Scenario: User wants to upgrade from 8.11.x to the next available version
mas upgrade --mas-instance-id inst1 --no-confirm --accept-licenseWhat happens:
Current channel: 8.11.x
Auto-determined next channel: 9.0.x (from upgrade_path)
masChannel passed to ansible: "" (empty - auto-determine)
Result: ✅ Upgrades MAS core and apps from 8.11.x → 9.0.x
Use Case 2: Explicit Upgrade with --next-channel
Scenario: User wants to explicitly upgrade to 9.0.x
mas upgrade --mas-instance-id inst1 --next-channel 9.0.x --no-confirm --accept-licenseWhat happens:
Current channel: 8.11.x
User-specified next channel: 9.0.x
Validation: ✅ 9.0.x == upgrade_path["8.11.x"] (valid path)
masChannel passed to ansible: "8.11.x" (so ansible looks up next)
Result: ✅ Upgrades MAS core and apps from 8.11.x → 9.0.x
Use Case 3: Retry Scenario (Core Already Upgraded) ⭐ NEW
Scenario: MAS core upgraded to 9.0.x but apps stuck on 8.11.x channel
mas upgrade --mas-instance-id inst1 --next-channel 9.0.x --no-confirm --accept-licenseWhat happens:
Current channel: 9.0.x (core already upgraded)
User-specified next channel: 9.0.x (same as current)
Detection: ✅ Retry scenario detected (nextChannel == currentChannel)
masChannel passed to ansible: "8.11.x" (previous channel, so ansible upgrades apps)
Result: ✅ Re-runs upgrade to ensure apps catch up to 9.0.x
Why this works:
When masChannel = "8.11.x", ansible-devops looks up upgrade_path["8.11.x"] → "9.0.x"
This triggers app upgrades from 8.11.x → 9.0.x channels
Core stays on 9.0.x (already there), apps get upgraded
Use Case 4: Invalid Upgrade Path
Scenario: User tries to skip a version
mas upgrade --mas-instance-id inst1 --next-channel 9.1.x --no-confirm --accept-licenseWhat happens:
Current channel: 8.11.x
User-specified next channel: 9.1.x
Validation: ❌ 9.1.x != upgrade_path["8.11.x"] (invalid - skips 9.0.x)
Result: ❌ FATAL ERROR: "No upgrade path available from 8.11.x to 9.1.x"
Use Case 5: App Compatibility Validation
Scenario: Manage app on incompatible channel
mas upgrade --mas-instance-id inst1 --next-channel 9.1.x --no-confirm --accept-licenseWhat happens:
Current channel: 9.0.x
User-specified next channel: 9.1.x
Installed apps: Manage on 8.7.x
Validation: ❌ Manage 8.7.x not compatible with MAS 9.1.x
Result: ❌ FATAL ERROR: "manage (currently on 8.7.x): Must be on one of ['8.11.x', '9.0.x'] to upgrade to MAS 9.1.x"
Testing
✅
All 5 test scenarios passing:
✅ Regular upgrade with --next-channel
✅ Retry scenario (core already upgraded)
✅ Auto-determine without --next-channel
✅ Invalid upgrade path validation
✅ App compatibility validation