Prevent latest apollo-ci tag on stackrox release branch configs#77736
Prevent latest apollo-ci tag on stackrox release branch configs#77736davdhacs wants to merge 1 commit intoopenshift:mainfrom
Conversation
Add a check to config.py that rejects release branch configs using the 'latest' floating tag for the build root image. The 'latest' tag is a moving target intended only for validation before promoting to 'stable'. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
WalkthroughAdds a validation check in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 9 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (9 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: davdhacs The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
[REHEARSALNOTIFIER] Note: If this PR includes changes to step registry files ( |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
ci-operator/config/stackrox/stackrox/config.py (1)
773-779: Match the floating tag explicitly, not via substring.The current check rejects any tag containing
latest, which can accidentally block non-floating pinned tags. Compare normalized tag value tolatestdirectly.Proposed fix
if config.branch.startswith('release-'): tag = config.build_root_tag - if tag and 'latest' in tag: + normalized_tag = tag.strip().lower() if isinstance(tag, str) else None + if normalized_tag == 'latest': check_error(f"{config.short_filename}: release branch '{config.branch}' " f"must not use 'latest' build root tag '{tag}'. " f"Pin to a specific version (e.g. stackrox-ui-test-0.5.7).") configs_ok = False🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ci-operator/config/stackrox/stackrox/config.py` around lines 773 - 779, The check in the release branch branch-block is matching 'latest' by substring in tag = config.build_root_tag which can falsely reject tags containing the word 'latest' as part of a pinned name; change the condition to normalize the build_root_tag (e.g., strip() and lower()) and compare equality to 'latest' (e.g., if tag and tag.strip().lower() == 'latest') before calling check_error and setting configs_ok = False so only the floating tag is rejected; update the condition around tag, config.branch.startswith('release-'), check_error and configs_ok accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@ci-operator/config/stackrox/stackrox/config.py`:
- Around line 773-779: The check in the release branch branch-block is matching
'latest' by substring in tag = config.build_root_tag which can falsely reject
tags containing the word 'latest' as part of a pinned name; change the condition
to normalize the build_root_tag (e.g., strip() and lower()) and compare equality
to 'latest' (e.g., if tag and tag.strip().lower() == 'latest') before calling
check_error and setting configs_ok = False so only the floating tag is rejected;
update the condition around tag, config.branch.startswith('release-'),
check_error and configs_ok accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 1fc3d479-563f-4ad4-98c1-ed406849bfe0
📒 Files selected for processing (1)
ci-operator/config/stackrox/stackrox/config.py
|
/cc @porridge |
|
@davdhacs: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
@davdhacs I think we want:
|
Summary
config.pythat rejects release branch configs using thelatestfloating tag for the build root image (apollo-ci)latesttag is a moving target intended only for validation before promoting tostablestackrox-stackrox-checkpresubmit on openshift/release PRs that modify stackrox configs🤖 Generated with Claude Code
Summary by CodeRabbit