Skip to content

feat(rhel-ai): add list-versions subcommand for AWS and Azure#843

Open
rishupk wants to merge 2 commits into
redhat-developer:mainfrom
rishupk:feat+azure-rhel-ai-list-versions
Open

feat(rhel-ai): add list-versions subcommand for AWS and Azure#843
rishupk wants to merge 2 commits into
redhat-developer:mainfrom
rishupk:feat+azure-rhel-ai-list-versions

Conversation

@rishupk

@rishupk rishupk commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

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 at docs/aws/rhelai.md and docs/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

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds a list-versions subcommand to RHEL AI provisioning on both AWS and Azure. AWS implements version discovery via AMI name queries (filtering by accelerator-derived patterns, extracting version substrings, and normalizing/sorting them), while Azure discovers versions via Compute Gallery prefix queries (converting gallery name suffixes to version strings). Both platforms share similar CLI wiring that binds the accelerator flag and prints discovered versions. AWS documentation covers list-versions, create, and destroy operations with concrete examples.

Changes

RHEL AI list-versions feature

Layer / File(s) Summary
AWS AMI listing data helper
pkg/provider/aws/data/ami.go
Adds ListAMIs(ctx, ImageRequest): constructs EC2 DescribeImages filters from request (name, optional region, optional architecture, optional block device type, optional owner), executes the query, and returns all matching images or error.
AWS ListVersions provider action
pkg/provider/aws/action/rhel-ai/rhelai.go
Adds sort and strings imports. Implements ListVersions(ctx, accelerator): validates accelerator (cuda/rocm), queries AMIs by accelerator-derived name pattern in us-east-1, extracts version substrings from AMI names, normalizes underscores to dashes, deduplicates and sorts versions, returns sorted list.
AWS list-versions CLI subcommand
cmd/mapt/cmd/aws/hosts/rhelai.go
Adds fmt import, list-versions constants, registers getRHELAIListVersions() on GetRHELAICmd(), and implements the subcommand that binds accelerator flag, calls rhelai.ListVersions, and prints each version to stdout.
Azure gallery listing data helper
pkg/provider/azure/data/images.go
Adds ListGalleriesByPrefix(ctx, subscriptionID, resourceGroup, namePrefix): initializes Azure credential and ARM compute client, pages through galleries in the resource group, filters by name prefix, returns matching gallery names or error.
Azure ListVersions provider action and constant refactor
pkg/provider/azure/action/rhel-ai/rhelai.go
Adds sort import. Introduces imageOwnerResourceGroup constant used in imageIdRegex. Implements ListVersions(ctx, accelerator): validates accelerator (cuda/rocm), builds gallery-name prefix, calls ListGalleriesByPrefix, strips prefix and normalizes underscores to dashes, sorts versions ascending, returns list with accelerator context in errors.
Azure list-versions CLI subcommand
cmd/mapt/cmd/azure/hosts/rhelai.go
Adds fmt import, list-versions constants, registers getRHELAIListVersions() on GetRHELAICmd(), and implements the subcommand that binds accelerator flag, calls rhelai.ListVersions, and prints each version to stdout.
AWS RHEL AI documentation
docs/aws/rhelai.md
Adds comprehensive guide: overview of GPU-enabled RHEL AI instances, list-versions operation with supported accelerators and podman example, create operation with all CLI flags and generated output artifacts, destroy operation with example teardown command.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title accurately describes the primary change: adding a list-versions subcommand for RHEL AI on both AWS and Azure platforms. It is concise, specific, and directly summarizes the main enhancement.
Description check ✅ Passed The description clearly relates to the changeset, explaining the new list-versions subcommand for both AWS and Azure RHEL AI providers with implementation details.

✏️ 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.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between aaa5c99 and 1b4ff3a.

📒 Files selected for processing (3)
  • cmd/mapt/cmd/azure/hosts/rhelai.go
  • pkg/provider/azure/action/rhel-ai/rhelai.go
  • pkg/provider/azure/data/images.go

Comment thread pkg/provider/azure/action/rhel-ai/rhelai.go
@rishupk rishupk force-pushed the feat+azure-rhel-ai-list-versions branch from 1b4ff3a to ba798ec Compare June 18, 2026 10:56
@adrianriobo

Copy link
Copy Markdown
Collaborator

Can we add same for aws? should be straightforward, and also add some documentaion around it in the README ?

rishupk and others added 2 commits June 19, 2026 09:37
- 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>
@rishupk rishupk force-pushed the feat+azure-rhel-ai-list-versions branch from 0f6b731 to 5501c0a Compare June 19, 2026 08:38
@rishupk

rishupk commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Added in e1367b5 and 5501c0a — AWS list-versions + docs for both.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1b4ff3a and 0f6b731.

📒 Files selected for processing (7)
  • cmd/mapt/cmd/aws/hosts/rhelai.go
  • cmd/mapt/cmd/azure/hosts/rhelai.go
  • docs/aws/rhelai.md
  • pkg/provider/aws/action/rhel-ai/rhelai.go
  • pkg/provider/aws/data/ami.go
  • pkg/provider/azure/action/rhel-ai/rhelai.go
  • pkg/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

Comment thread pkg/provider/aws/action/rhel-ai/rhelai.go
@rishupk rishupk changed the title feat(azure/rhel-ai): add list-versions subcommand feat(rhel-ai): add list-versions subcommand for AWS and Azure Jun 19, 2026
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.

2 participants