← Back to Pull requests

ROSAENG-66395 | feat: add notification-contacts flag to CLI #3500

Closed
unknown closed this pull request without merging on Sep 14, 2026 17:22 UTC
View on GitHub
unknown unknown commented on Sep 04, 2026 17:10 UTC
Author

PR Summary

Add --notification-contacts flag to rosa create cluster and rosa edit cluster, and display notification contacts in rosa describe cluster output (both text and JSON).

Detailed Description of the Issue

ROSA cluster owners need the ability to configure additional OCM account usernames or email addresses to receive cluster notification emails directly from the CLI. Notification contacts are stored on the cluster's subscription (OCM Accounts Management API), not the cluster object itself.

This PR adds end-to-end CLI support for managing notification contacts:

  • Create: Set contacts at cluster creation time as a post-create step (same pattern as delete protection)

  • Edit: Add, modify, or clear contacts on an existing cluster (follows the additionalAllowedPrincipals pattern with '' to clear)

  • Describe: Display contacts in both text and JSON output
  • The implementation uses the OCM SDK's SubscriptionBuilder.NotificationContacts() PATCH endpoint, which replaces the entire contact list atomically. Both OCM usernames and email addresses are accepted — the API resolves emails to usernames internally. Since the CLI has no state between runs (unlike the Terraform provider), there is no drift risk from accepting emails.

    Related Issues and PRs

  • Jira: ROSAENG-66395

  • Related PR(s): Terraform provider implementation
  • Type of Change

  • feat - adds a new user-facing capability.

  • fix - resolves an incorrect behavior or bug.

  • docs - updates documentation only.

  • style - formatting or naming changes with no logic impact.

  • refactor - code restructuring with no behavior change.

  • test - adds or updates tests only.

  • chore - maintenance work (tooling, housekeeping, non-product code).

  • build - changes build system, packaging, or dependencies for build output.

  • ci - changes CI pipelines, jobs, or automation workflows.

  • perf - improves performance without changing intended behavior.
  • Previous Behavior

    The rosa CLI had no support for managing notification contacts. Cluster owners had to use the OCM API directly or the web console to configure additional notification email recipients.

    Behavior After This Change

    rosa create cluster

    New --notification-contacts flag accepts a comma-separated list of OCM usernames or email addresses. Contacts are set via the Accounts Management API immediately after cluster creation (before returning).

    rosa create cluster --cluster-name my-cluster --hosted-cp --sts ... \
      --notification-contacts "user1,user2@example.com"
    

    Interactive mode prompts for notification contacts only if deploying with a service account.

    rosa edit cluster

    New --notification-contacts flag to add, modify, or clear contacts:

    # Set contacts
    rosa edit cluster --cluster my-cluster --notification-contacts "user1,user2"
    
    # Clear all contacts
    rosa edit cluster --cluster my-cluster --notification-contacts 
    

    Interactive mode asks whether to update contacts, shows current contacts as the default, and allows comma-separated input.

    rosa describe cluster

    Notification contacts are displayed in both text and JSON output when contacts exist:

    Text output:

    Notification Contacts:      user1, user2
    

    JSON output:

    {
      "notification_contacts": ["user1", "user2"]
    }
    

    When no contacts are set, the field is omitted from both outputs.

    How to Test (Step-by-Step)

    Preconditions

  • rosa CLI built from this branch (make rosa)

  • Logged in to OCM (rosa login)

  • An existing ROSA cluster (HCP or Classic)

  • At least one valid OCM username in the same Red Hat organization
  • Test Steps

    1. Build the CLI:

       make rosa
       

    2. Set notification contacts on an existing cluster:

       rosa edit cluster --cluster <cluster-name> --notification-contacts "<username1>,<username2>"
       

    3. Verify contacts appear in describe (text):

       rosa describe cluster --cluster <cluster-name>
       

    Look for Notification Contacts: line.

    4. Verify contacts appear in describe (JSON):

       rosa describe cluster --cluster <cluster-name> --output json | jq .notification_contacts
       

    5. Clear contacts:

       rosa edit cluster --cluster <cluster-name> --notification-contacts ''
       

    6. Verify contacts are cleared:

       rosa describe cluster --cluster <cluster-name> --output json | jq .notification_contacts
       

    Should return null.

    7. Run unit tests:

       make test
       

    8. Run structure tests:

       go test ./cmd/rosa/structure_test/...
       

    Expected Results

  • rosa edit cluster --notification-contacts sets, modifies, or clears contacts

  • rosa describe cluster displays contacts in both text and JSON output

  • rosa create cluster --notification-contacts sets contacts at creation time

  • All unit tests pass (6 new notification contacts tests)

  • Structure tests pass (flag registered in command_args.yml for both create and edit)
  • Proof of the Fix

  • Logs/CLI output: Unit tests passing (make test), structure tests passing, lint clean (make lint), build succeeds (make rosa)
  • Breaking Changes

  • No breaking changes
  • Breaking Change Details / Migration Plan


    N/A

    Developer Verification Checklist

  • Commit subject/title follows [JIRA-TICKET] | [TYPE]: <MESSAGE>.

  • PR description clearly explains both what changed and why.

  • Relevant Jira/GitHub issues and related PRs are linked.

  • make install-hooks has been run in this clone.

  • Tests were added/updated where appropriate.

  • I manually tested the change.

  • make test passes.

  • make lint passes.

  • make rosa passes.

  • Documentation or repo-local agent guidance was added/updated where appropriate.

  • Any risk, limitation, or follow-up work is documented.
  • [ROSAENG-66395]: https://redhat.atlassian.net/browse/ROSAENG-66395?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

  • New Features

  • - Configure cluster notification contacts during creation or editing using comma-separated usernames or email addresses.
    - Set, replace, or clear contacts through interactive prompts or command-line options.
    - Generated cluster recreation commands preserve configured contacts.
    - View notification contacts in structured and human-readable cluster descriptions.
    - Contacts are deduplicated and displayed in sorted order.
  • Bug Fixes

  • - Clear errors are reported when contact updates cannot be completed.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: michaelryanmcneill Review duration: 14411m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3500"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%
    Repository