Skip to content

Conversation

@rnetser
Copy link
Collaborator

@rnetser rnetser commented Nov 12, 2025

Short description:

When a resource is created, by default if cluster expected exceptions are raised, there will be a retry.
To overwrite and not wait - exceptions_dict={} should be passed

More details:
What this PR does / why we need it:
Which issue(s) this PR fixes:
Special notes for reviewer:
Bug:

Summary by CodeRabbit

  • New Features

    • Resource creation now provides enhanced exception retry handling with configurable behavior.
  • Bug Fixes

    • Improved resource creation return type for better error handling and resource tracking.

@coderabbitai
Copy link

coderabbitai bot commented Nov 12, 2025

Walkthrough

Updates the Resource.create method to accept an exceptions_dict parameter and return ResourceInstance | None instead of bool. Routes API calls through Resource.retry_cluster_exceptions for consistent retry behavior instead of direct api.create invocation, while maintaining existing dry_run and resource version handling.

Changes

Cohort / File(s) Summary
Resource.create refactor
ocp_resources/resource.py
Method signature updated to accept exceptions_dict parameter (default: DEFAULT_CLUSTER_RETRY_EXCEPTIONS). Return type changed from bool to ResourceInstance | None. Core creation logic routes through Resource.retry_cluster_exceptions wrapper instead of direct api.create call. Added type annotation for resource_kwargs as dict[str, Any].

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Public API surface change (signature and return type modification) requires validation of downstream impacts
  • Logic shift to use retry wrapper should be verified for behavioral equivalence with direct call path
  • Single file change with focused scope reduces complexity

Possibly related PRs

Suggested labels

size/M, branch-main, can-be-merged, approved-rnetser

Suggested reviewers

  • myakove

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The short description section is filled with relevant details about the change, but several required template sections (More details, What this PR does / why we need it, Which issue(s) this PR fixes, Special notes for reviewer, Bug) are empty or missing meaningful content. Fill in the empty template sections with additional context about the change, including motivation, related issues, and any special considerations for reviewers.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The pull request title accurately describes the main change: adding retry functionality on resource creation through the updated create method signature and routing to retry_cluster_exceptions.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch retry-exception

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.

@redhat-qe-bot2
Copy link

Report bugs in Issues

Welcome! 🎉

This pull request will be automatically processed with the following features:

🔄 Automatic Actions

  • Reviewer Assignment: Reviewers are automatically assigned based on the "
    "OWNERS file in the repository root
    "
    "* Size Labeling: PR size labels (XS, S, M, L, XL, XXL) are "
    "automatically applied based on changes
    "
    f"* Issue Creation: A tracking issue is created for this PR and will be closed when the PR is merged or closed
    "
    "* Pre-commit Checks: pre-commit runs "
    "automatically if .pre-commit-config.yaml exists
    "
  • Branch Labeling: Branch-specific labels are applied to track the target branch
  • Auto-verification: Auto-verified users have their PRs automatically marked as verified

📋 Available Commands

PR Status Management

  • /wip - Mark PR as work in progress (adds WIP: prefix to title)
  • /wip cancel - Remove work in progress status
  • /hold - Block PR merging (approvers only)
  • /hold cancel - Unblock PR merging
  • /verified - Mark PR as verified
  • /verified cancel - Remove verification status
  • /reprocess - Trigger complete PR workflow reprocessing (useful if webhook failed or configuration changed)

Review & Approval

  • /lgtm - Approve changes (looks good to me)
  • /approve - Approve PR (approvers only)
  • /automerge - Enable automatic merging when all requirements are met (maintainers and approvers only)
  • /assign-reviewers - Assign reviewers based on OWNERS file
  • /assign-reviewer @username - Assign specific reviewer
  • /check-can-merge - Check if PR meets merge requirements

Testing & Validation

  • /retest tox - Run Python test suite with tox
  • /retest python-module-install - Test Python package installation
  • /retest conventional-title - Validate commit message format
  • /retest all - Run all available tests

Container Operations

  • /build-and-push-container - Build and push container image (tagged with PR number)
    • Supports additional build arguments: /build-and-push-container --build-arg KEY=value

Cherry-pick Operations

  • /cherry-pick <branch> - Schedule cherry-pick to target branch when PR is merged
    • Multiple branches: /cherry-pick branch1 branch2 branch3

Label Management

  • /<label-name> - Add a label to the PR
  • /<label-name> cancel - Remove a label from the PR

✅ Merge Requirements

This PR will be automatically approved when the following conditions are met:

  1. Approval: /approve from at least one approver
  2. LGTM Count: Minimum 0 /lgtm from reviewers
  3. Status Checks: All required status checks must pass
  4. No Blockers: No WIP, hold, or conflict labels
  5. Verified: PR must be marked as verified (if verification is enabled)

📊 Review Process

Approvers and Reviewers

Approvers:

  • myakove
  • rnetser

Reviewers:

  • dbasunag
  • myakove
  • rnetser
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
  • automerge

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is automatically removed on each new commit
  • Cherry-picking: Cherry-pick labels are processed when the PR is merged
  • Container Builds: Container images are automatically tagged with the PR number
  • Permission Levels: Some commands require approver permissions
  • Auto-verified Users: Certain users have automatic verification and merge privileges

For more information, please refer to the project documentation or contact the maintainers.

@rnetser rnetser changed the title Add retry on resource creation Feature: Add retry on resource creation Nov 13, 2025
@rnetser
Copy link
Collaborator Author

rnetser commented Nov 13, 2025

/retest conventional-title

@rnetser rnetser changed the title Feature: Add retry on resource creation feat: Add retry on resource creation Nov 13, 2025
@rnetser
Copy link
Collaborator Author

rnetser commented Nov 13, 2025

/retest conventional-title

@Ahmad-Hafe
Copy link
Contributor

/lgtm

@rnetser
Copy link
Collaborator Author

rnetser commented Nov 13, 2025

/verified

@myakove
Copy link
Collaborator

myakove commented Nov 14, 2025

/approve

@myakove myakove enabled auto-merge (squash) November 14, 2025 09:55
@myakove myakove merged commit e1e028b into main Nov 14, 2025
7 checks passed
@myakove myakove deleted the retry-exception branch November 14, 2025 09:56
@Ahmad-Hafe
Copy link
Contributor

/cherry-pick v4.20

@redhat-qe-bot
Copy link
Contributor

Cherry-picked PR feat: Add retry on resource creation into v4.20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants