Fix per-component criteria for multi-arch#3272
Fix per-component criteria for multi-arch#3272simonbaird wants to merge 1 commit intoconforma:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughCriteria.get now treats component-scoped lookups to include both the provided componentName and an original name computed by stripping a multi-arch expanded suffix of the form ChangesMulti-Arch Component Matching
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
71124c4 to
36cefe7
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
internal/evaluator/criteria_test.go (1)
980-1077:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winFix gci formatting in this test block before merge
golangci-lintreports this file as not properly formatted (Line 983). Please run formatting/import normalization for this file so CI passes.🤖 Prompt for 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. In `@internal/evaluator/criteria_test.go` around lines 980 - 1077, The test file fails golangci-lint gci formatting around the TestOriginalComponentName block; run your Go import/format tools (gofmt/gci or goimports) on the file and reformat imports so the TestOriginalComponentName test table and the originalComponentName usages follow the project's gci rules, then re-run CI; ensure the tests slice and its entries (the table-driven tests) and import ordering are normalized before committing.
🤖 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 `@internal/evaluator/criteria.go`:
- Around line 134-141: The regex in multiArchSuffixRe is too permissive (uses
[0-9a-f]+) and wrongly strips names like "foo-sha256:abc-arm64"; tighten it to
match a full SHA-256 hex digest by requiring exactly 64 hex chars and allow
uppercase too (e.g., use [0-9a-fA-F]{64} or a case-insensitive flag) so
originalComponentName only removes true multi-arch suffixes; update the
multiArchSuffixRe definition accordingly and keep originalComponentName as-is.
---
Outside diff comments:
In `@internal/evaluator/criteria_test.go`:
- Around line 980-1077: The test file fails golangci-lint gci formatting around
the TestOriginalComponentName block; run your Go import/format tools (gofmt/gci
or goimports) on the file and reformat imports so the TestOriginalComponentName
test table and the originalComponentName usages follow the project's gci rules,
then re-run CI; ensure the tests slice and its entries (the table-driven tests)
and import ordering are normalized before committing.
🪄 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: 6bceb4c7-3e18-4d9a-b4ee-f68391d0a243
📒 Files selected for processing (2)
internal/evaluator/criteria.gointernal/evaluator/criteria_test.go
36cefe7 to
dae61a1
Compare
For multi-arch images, the original component gets expanded into several components, each with a name that includes a digest and an arch. This patch makes sure those additional components can also match a volatile exclude with component name criteria. Bug originally reported in https://redhat.atlassian.net/browse/KFLUXSPRT-7780 Ref: https://redhat.atlassian.net/browse/EC-1800 Co-authored-by: Claude Code <noreply@anthropic.com>
dae61a1 to
3cc2555
Compare
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
For multi-arch images, the original component gets expanded into several components, each with a name that includes a digest and an arch. This patch makes sure those additional components can also match a volatile exclude with component name criteria.
Bug originally reported in
https://redhat.atlassian.net/browse/KFLUXSPRT-7780
Ref: https://redhat.atlassian.net/browse/EC-1800