feat(rhel-ai): add list-versions subcommand for AWS and Azure#843
feat(rhel-ai): add list-versions subcommand for AWS and Azure#843rishupk wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughThe PR adds a ChangesRHEL AI list-versions feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/provider/azure/action/rhel-ai/rhelai.go`:
- Around line 114-118: In the ListVersions function, add validation and
normalization of the accelerator parameter before building the gallery prefix on
line 115. First, validate that the accelerator parameter is not empty and is a
supported/valid value for RHEL AI. Then normalize the accelerator value (likely
converting it to lowercase) to ensure consistent prefix matching regardless of
input case variations. This prevents silent empty results from invalid or
case-variant accelerator values.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: 8f30422e-deb8-4cfc-a919-5abe63a3d8b1
📒 Files selected for processing (3)
cmd/mapt/cmd/azure/hosts/rhelai.gopkg/provider/azure/action/rhel-ai/rhelai.gopkg/provider/azure/data/images.go
1b4ff3a to
ba798ec
Compare
|
Can we add same for aws? should be straightforward, and also add some documentaion around it in the README ? |
- Add ListGalleriesByPrefix to data/images.go — queries Azure Compute Gallery by resource group and name prefix using the SDK - Add ListVersions to the rhel-ai action — enumerates available RHEL AI image versions for a given accelerator type from the owner gallery - Add `mapt azure rhel-ai list-versions --accelerator <cuda|rocm>` cobra subcommand to expose version discovery via CLI - Extract imageOwnerResourceGroup constant from the hardcoded string in imageIdRegex Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Rishabh Kothari <rkothari@redhat.com>
- Add ListAMIs() data helper returning all matching AMIs (vs GetAMI's newest-only) - Add ListVersions() action querying us-east-1 AMIs by accelerator with validation - Wire list-versions cobra subcommand with --accelerator flag - Add docs/aws/rhelai.md documenting create, destroy, and list-versions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Rishabh Kothari <rkothari@redhat.com>
0f6b731 to
5501c0a
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/provider/aws/action/rhel-ai/rhelai.go`:
- Line 171: The ListVersions function uses sort.Strings() which performs
lexicographic sorting, causing semantic versions like "1.10.0" to incorrectly
sort before "1.2.0". Replace the sort.Strings(versions) call with semantic
version sorting using the golang.org/x/mod/semver library to ensure versions are
ordered correctly. Import the semver package and use its comparison function to
sort the versions slice according to semantic version rules rather than
alphabetical order.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: c87e500d-2a5c-4865-903a-75e9e92e575c
📒 Files selected for processing (7)
cmd/mapt/cmd/aws/hosts/rhelai.gocmd/mapt/cmd/azure/hosts/rhelai.godocs/aws/rhelai.mdpkg/provider/aws/action/rhel-ai/rhelai.gopkg/provider/aws/data/ami.gopkg/provider/azure/action/rhel-ai/rhelai.gopkg/provider/azure/data/images.go
🚧 Files skipped from review as they are similar to previous changes (3)
- cmd/mapt/cmd/azure/hosts/rhelai.go
- pkg/provider/azure/data/images.go
- pkg/provider/azure/action/rhel-ai/rhelai.go
Adds
mapt <aws|azure> rhel-ai list-versions --accelerator <cuda|rocm>so consumers can query available RHEL AI versions through mapt directly. Azure queries the Compute Gallery by gallery name prefix; AWS queries AMIs by name pattern from a reference region (us-east-1). Both validate the accelerator and return sorted version strings. Includes docs for both providers atdocs/aws/rhelai.mdanddocs/azure/rhelai.md.Tested end-to-end inside Claudio — both providers return correct version lists for CUDA and ROCm.
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com
Signed-off-by: Rishabh Kothari rkothari@redhat.com