ROSAENG-64541 | fix: switch bingo tool modules - #3447
Conversation
…r and bump tool versions Signed-off-by: Amanda Hager Lopes de Andrade Katz <amanda.katz@redhat.com>
📝 WalkthroughWalkthroughUpdated Goreleaser to v2.17.1, Govulncheck to v1.6.0, and Mockgen to v0.6.0 across Bingo build configuration and module files. Updated the Goreleaser module to Go 1.26.5 and a direct Goreleaser requirement. Revised Renovate configuration to detect required tool versions in Suggested reviewers: 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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: amandahla 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 |
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 `@renovate.json`:
- Around line 110-118: Move the Bingo regex configuration into customManagers,
using managerFilePatterns for .bingo/*.mod and preserving its Go dependency
matchStrings and datasourceTemplate. Add or retain a separate packageRules entry
matching the Bingo dependencies to apply the bingo-tooling groupName, and remove
the misplaced matchFileNames manager block.
🪄 Autofix
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: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 515c5bfa-bec4-4a20-9af4-d6387870bbf6
⛔ Files ignored due to path filters (3)
.bingo/goreleaser.sumis excluded by!**/*.sum.bingo/govulncheck.sumis excluded by!**/*.sum.bingo/mockgen.sumis excluded by!**/*.sum
📒 Files selected for processing (6)
.bingo/Variables.mk.bingo/goreleaser.mod.bingo/govulncheck.mod.bingo/mockgen.mod.bingo/variables.envrenovate.json
| "customType": "regex", | ||
| "description": "Group Bingo-managed tool modules", | ||
| "groupName": "bingo-tooling", | ||
| "matchManagers": [ | ||
| "gomod" | ||
| ], | ||
| "matchFileNames": [ | ||
| ".bingo/*.mod" | ||
| ], | ||
| "datasourceTemplate": "go", | ||
| "matchStrings": [ | ||
| "require\\s+(?<depName>\\S+)\\s+(?<currentValue>v[^\\s]+)" |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
python3 - <<'PY'
import json
with open("renovate.json", encoding="utf-8") as f:
config = json.load(f)
managers = [
manager for manager in config.get("customManagers", [])
if manager.get("customType") == "regex"
and manager.get("datasourceTemplate") == "go"
]
assert managers, "Missing Go regex custom manager"
for manager in managers:
assert manager.get("managerFilePatterns"), (
"Regex custom manager must define managerFilePatterns"
)
assert "matchFileNames" not in manager, (
"matchFileNames belongs in packageRules"
)
assert "groupName" not in manager, (
"Move grouping to packageRules"
)
assert any(
"custom.regex" in rule.get("matchManagers", [])
and rule.get("groupName") == "bingo-tooling"
and ".bingo/*.mod" in rule.get("matchFileNames", [])
for rule in config.get("packageRules", [])
), "Missing Bingo custom.regex grouping package rule"
PYRepository: openshift/rosa
Length of output: 274
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
printf 'renovate.json size:\n'
wc -l renovate.json
printf '\nRelevant renovate.json lines 1-180:\n'
sed -n '1,180p' renovate.json | cat -n
printf '\nChanged lines/stat around renovate.json:\n'
git diff --stat -- renovate.json || true
git diff --unified=80 -- renovate.json || trueRepository: openshift/rosa
Length of output: 5647
🌐 Web query:
Renovate custom managers regex managerFilePatterns matchFileNames packageRules
💡 Result:
In Renovate, custom managers (particularly the regex type) use specific configuration fields to identify and process files, which operate differently from packageRules. Key Configuration Fields: 1. managerFilePatterns: Used within customManagers to tell Renovate which files to scan [1][2]. It accepts an array of strings, which can be either glob patterns or regular expressions (if wrapped in slashes, e.g., /Dockerfile$/) [1][3][4]. These patterns are used to filter the repository's file list to find where to apply your regex logic [1][3]. 2. matchStrings: Used by the regex custom manager to extract dependency information from the files identified by managerFilePatterns [1][2]. It requires regular expressions with named capture groups to identify the datasource, depName (or packageName), and currentValue [1][5][2]. Relationship to packageRules: There is a distinct difference between how file matching is handled in custom managers and packageRules: - customManagers use managerFilePatterns (historically referred to as fileMatch in some contexts) to target files for extraction [1][5][6]. - packageRules use matchFileNames to filter which rules apply to dependencies already identified by a manager [6]. While recent developments have aimed for more consistency between these mechanisms, matchFileNames in packageRules specifically targets the file path of the identified dependency [6]. It supports both glob and regex patterns [6]. You cannot directly use packageRules to define the logic for a custom manager; instead, you use customManagers to extract the dependencies and then use packageRules to apply specific configurations (like versioning or auto-merge) to those dependencies based on the manager or filename [7]. For best results, keep these configurations separate: use customManagers to define "how to find" dependencies, and use packageRules to define "how to treat" those dependencies once found [2][7].
Citations:
- 1: https://docs.renovatebot.com/modules/manager/regex/
- 2: https://docs.renovatebot.com/configuration-options/
- 3: https://github.com/renovatebot/renovate/blob/main/docs/usage/modules/manager/index.md
- 4: https://docs.renovatebot.com/modules/manager/
- 5: https://github.com/renovatebot/renovate/blob/main/docs/usage/configuration-options.md
- 6: Provide a consistent way to specify file paths in packageRules and customManagers renovatebot/renovate#34416
- 7: `packageRules.*.matchManagers` for a `customManger`? renovatebot/renovate#33634
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
printf 'JSON fragment around custom regex / packageRules:\n'
python3 - <<'PY'
import json
with open("renovate.json", encoding="utf-8") as f:
data = json.load(f)
for key in ["customManagers", "packageRules"]:
print(f"\n--- {key} ---")
print(json.dumps(data.get(key), indent=2))
PY
printf '\nFiles using .bingo/*.mod patterns:\n'
rg -n '"\\.bingo/\\*\\.mod"|matchFileNames|managerFilePatterns|customManagers|packageRules' renovate.json || trueRepository: openshift/rosa
Length of output: 3447
Move the Bingo regex manager into customManagers with file patterns.
The block at lines 110–120 is matchFileNames; it is not a manager entry, and matchFileNames is a package-rule matcher. As a result, no custom.regex manager extracts dependencies from .bingo/*.mod, so removing the gomod file selector stops Renoate from updating those Bingo modules.
Add the Bingo custom.regex manager under customManagers with managerFilePatterns: [".bingo/*.mod"], and keep the grouping in a matching packageRules entry.
🤖 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 `@renovate.json` around lines 110 - 118, Move the Bingo regex configuration
into customManagers, using managerFilePatterns for .bingo/*.mod and preserving
its Go dependency matchStrings and datasourceTemplate. Add or retain a separate
packageRules entry matching the Bingo dependencies to apply the bingo-tooling
groupName, and remove the misplaced matchFileNames manager block.
Depends on #3388 since Goreleaser requires Go 1.26.5
PR Summary
Fix Renovate's handling of
.bingo/tool modules by switching from thegomodmanager to a custom regex manager, and bump govulncheck, goreleaser, and mockgen to their latest versions.Detailed Description of the Issue
Renovate's
gomodmanager treats.bingo/*.modfiles as full Go modules. When it processes them, it resolves and injects hundreds of transitive// indirectdependencies into the mod files (e.g.goreleaser.modgrew to 376 dependency lines). Bingo mod files are designed tohold a single direct
requireline; the injected dependencies pollute version control, produce noisy diffs, and can interfere withbingo-managed installs.This change removes
.bingo/*.modfrom thegomodmanager'smanagerFilePatternsand replaces the bingo-tooling package rule with a custom regex manager that extracts only the directrequireline from each mod file.Alongside the Renovate fix, pinned tool versions are bumped:
The
goreleaser.modfile is cleaned back to its intended minimal form (376 indirect dependency lines removed).Related Issues and PRs
Type of Change
Previous Behavior
Renovate's
gomodmanager processed.bingo/*.modfiles as regular Go modules, injecting all transitive indirect dependencies into the mod files. This produced PRs with massive diffs (e.g. 1400+ lines ingoreleaser.mod) and corrupted bingo's single-require pinning format.Behavior After This Change
Renovate uses a custom regex manager to detect only the direct
requireline in each.bingo/*.modfile. Future Renovate PRs for bingo tools will contain clean, single-line version bumps. Tool versions are now current: govulncheck v1.6.0, goreleaser v2.17.1, mockgen v0.6.0.How to Test (Step-by-Step)
Preconditions
Test Steps
.bingo/*.modfiles contain only the module header, go directive, and a singlerequireline (no// indirectblocks).make generateto confirm mockgen v0.6.0 installs and generates mocks successfully.renovate.jsonsyntax with the Renovate config validator ornpx --yes --package renovate -- renovate-config-validator.Expected Results
.bingo/*.modfiles are minimal (singlerequireline each).make generatesucceeds with the updated mockgen.renovate.jsonpasses config validation.Proof of the Fix
goreleaser.modreduced from 381 lines to 5 lines.Breaking Changes
Breaking Change Details / Migration Plan
N/A
Developer Verification Checklist
[JIRA-TICKET] | [TYPE]: <MESSAGE>.make install-hookshas been run in this clone.make testpasses.make lintpasses.make rosapasses.