feat(ansible): allow excluding VM images by regex#3527
Conversation
This is useful for creating exclusions for images that might change underneath us like RHCOS.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe VM exclusion guidance adds ChangesRegex-based VM exclusions
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 `@ansible/roles/create-vm/tasks/main.yml`:
- Around line 14-15: The VM exclusion check in the create-vm task is treating
every entry in excluded_vms as an unanchored regex, which can broaden matches
unexpectedly for vm_image. Update the expression used in the task’s excluded
flag so image exclusions either match the full image name exactly with anchored
regex boundaries or come from a separate excluded_images list, and keep the
logic in the when condition aligned with that stricter match behavior.
🪄 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: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: b212743b-19cb-4ef5-b018-e35da0999dd6
📒 Files selected for processing (2)
ansible/group_vars/all.ymlansible/roles/create-vm/tasks/main.yml
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3527 +/- ##
=======================================
Coverage 27.34% 27.34%
=======================================
Files 95 95
Lines 5420 5420
Branches 2545 2545
=======================================
Hits 1482 1482
Misses 3211 3211
Partials 727 727
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Also rolls back the behavior allowing for full matching of images via excluded_vms
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 `@ansible/roles/create-vm/tasks/main.yml`:
- Around line 17-20: The regex-based exclusion check in the create-vm tasks
should be skipped when excluded_images is empty, because joining an empty list
produces an empty pattern that matches every vm_image. Update the set_fact task
named Check image excluded (regex) to guard on excluded_images being defined and
non-empty before calling regex_search, while keeping the existing vm_image and
not excluded conditions intact.
🪄 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: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 1684bcc0-b7ec-4793-93b2-75f2cab374a4
📒 Files selected for processing (2)
ansible/group_vars/all.ymlansible/roles/create-vm/tasks/main.yml
Description
This is useful for creating exclusions for images that might change underneath us like RHCOS.
Checklist
Automated testing
If any of these don't apply, please comment below.
Testing Performed
Tested on stackrox/fact#925