Skip to content

chore(ci): add go.mod/dependabot consistency check#19284

Merged
porridge merged 2 commits intomasterfrom
gomod-x-check
Mar 5, 2026
Merged

chore(ci): add go.mod/dependabot consistency check#19284
porridge merged 2 commits intomasterfrom
gomod-x-check

Conversation

@porridge
Copy link
Copy Markdown
Contributor

@porridge porridge commented Mar 4, 2026

Description

Problem: go.mod files can be added or removed without updating dependabot.yaml, leading to missing dependency updates or stale configuration entries.
Example:

This PR adds a new check in the style workflow to ensure all go.mod files have corresponding dependabot configurations and that there are no orphaned configurations.

As it turns out, there were more cases which need fixing:

  • Removed orphaned configs: /tools/retest/, /scanner/tools/
  • Added missing configs: /scanner/hack/quay, /tests/performance/scale, /tools/check-workflow-run

User-facing documentation

  • CHANGELOG.md is updated OR update is not needed (CI-only change)
  • documentation PR is created and is linked above OR is not needed (CI-only change)

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag (CI-only change)
  • CI results are inspected

Automated testing

The check script itself validates the consistency. No additional automated tests needed as the script runs in CI.

How I validated my change

  • Ran the check script locally before fixes - it correctly identified all mismatches
  • Applied the fixes to dependabot.yaml
  • Ran the check script again - it passes with all go.mod files matched
  • Verified the script is executable and follows the pattern of existing check scripts

🤖 Generated with AI assistance

Add a new check in the style workflow to ensure all go.mod files have
corresponding dependabot configurations and no orphaned configurations
exist.

The check validates that:
- All go.mod files in the repository have a gomod update entry in
  dependabot.yaml
- No dependabot gomod configurations reference non-existent go.mod files

Fixed current inconsistencies:
- Removed orphaned configs: /tools/retest/, /scanner/tools/
- Added missing configs: /scanner/hack/quay, /tests/performance/scale,
  /tools/check-workflow-run

Partially generated with AI assistance.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Mar 4, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The nested loops used to detect missing and orphaned directories are O(n²); consider using comm/join on the sorted gomod_dirs and dependabot_dirs arrays to simplify the logic and make the script more efficient and easier to read.
  • It may be helpful to fail fast with a clear message if prerequisites like .github/dependabot.yaml or yq are missing, rather than relying on less obvious downstream errors.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The nested loops used to detect missing and orphaned directories are O(n²); consider using `comm`/`join` on the sorted `gomod_dirs` and `dependabot_dirs` arrays to simplify the logic and make the script more efficient and easier to read.
- It may be helpful to fail fast with a clear message if prerequisites like `.github/dependabot.yaml` or `yq` are missing, rather than relying on less obvious downstream errors.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@porridge porridge requested review from davdhacs and janisz March 4, 2026 07:35
@porridge porridge marked this pull request as ready for review March 4, 2026 07:35
@porridge porridge requested a review from a team as a code owner March 4, 2026 07:35
…ness

Improvements:
- Replace O(n²) nested loops with comm for O(n log n) performance
- Add prerequisite checks for .github/dependabot.yaml and yq
- Use temporary files and comm to simplify diff logic
- Add proper cleanup with trap for temporary files

The script now fails fast with clear messages if prerequisites are
missing, and uses more efficient set operations for comparing directories.

Partially generated with AI assistance.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@rhacs-bot
Copy link
Copy Markdown
Contributor

rhacs-bot commented Mar 4, 2026

Images are ready for the commit at df2a372.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.11.x-233-gdf2a372e78.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.61%. Comparing base (009726f) to head (df2a372).
⚠️ Report is 11 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #19284      +/-   ##
==========================================
- Coverage   49.61%   49.61%   -0.01%     
==========================================
  Files        2680     2680              
  Lines      202195   202195              
==========================================
- Hits       100327   100325       -2     
- Misses      94390    94392       +2     
  Partials     7478     7478              
Flag Coverage Δ
go-unit-tests 49.61% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@porridge
Copy link
Copy Markdown
Contributor Author

porridge commented Mar 4, 2026

@sourcery-ai review

@porridge porridge added the auto-retest PRs with this label will be automatically retested if prow checks fails label Mar 4, 2026
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@rhacs-bot
Copy link
Copy Markdown
Contributor

/retest

Copy link
Copy Markdown
Contributor

@davdhacs davdhacs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 nice!

@janisz
Copy link
Copy Markdown
Contributor

janisz commented Mar 5, 2026

@porridge porridge merged commit 9ffd26c into master Mar 5, 2026
106 checks passed
@porridge porridge deleted the gomod-x-check branch March 5, 2026 06:53
ksurabhi91 pushed a commit that referenced this pull request Mar 12, 2026
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-assisted ai-review area/ci auto-retest PRs with this label will be automatically retested if prow checks fails

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants