chore: sync codecov components dynamically from overlay support levels#3463
chore: sync codecov components dynamically from overlay support levels#3463gustavolira wants to merge 6 commits into
Conversation
Make the Codecov support-level components self-update from the rhdh-plugin-export-overlays `spec.support` metadata instead of being hand-maintained. - generate-codecov-components.sh: add --write (rewrite the component_management block in place) and --check (fail + diff on drift) modes; include only workspaces that exist in this repo; deterministic, portable (GNU/BSD), shellcheck-clean. - Add sync-codecov-components.yml workflow: weekly + on-demand auto PR when a plugin's support level changes, plus a pull_request drift check. - Regenerate codecov.yml to the filtered set, dropping component paths for overlay workspaces that don't exist in this repository. - Update docs/codecov-support-levels.md for the automated flow and counts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PR Summary by QodoDynamically sync Codecov components from overlay support levels Description
Diagram
High-Level Assessment
Files changed (4)
|
Code Review by Qodo
1. Sync job concurrency key mismatch
|
- generate-codecov-components.sh: pin sort to LC_ALL=C so output is byte-stable across locales (keeps --check from false-positiving when regenerated on a non-C-locale machine). - Emit single-quoted component names to match the repo's prettier config (@spotify/prettier-config), so the generated block is style-conformant and future root-level formatting can't desync it from --check. - Make --write atomic: render into a temp file beside codecov.yml and mv it into place instead of cp (no half-written file on interruption). - Replace the fragile line-range usage() with a self-contained heredoc. - Add persist-credentials: false to the read-only checkouts in the workflow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The `case "$MODE"` dispatch only handled print/write/check. Add a `*)` branch that errors out so a future flag that sets MODE without a matching branch fails loudly instead of silently no-op'ing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The component list was a fixed set of four generate_component calls, so a new support level introduced in the overlay would have been silently dropped. Discover the distinct spec.support values from the metadata instead, deriving component_id/name mechanically (<level>-plugins / Title-Case Plugins). Only the GA label keeps an explicit alias, since "ga" can't be derived from "generally-available". SUPPORT_LEVEL_ORDER controls display order for known levels and appends any new level rather than dropping it. Output is byte-identical to before (codecov.yml unchanged); verified a synthetic new level appears as its own component. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Per review, the GA component name does not need to stay "ga-plugins". Remove the only hardcoded label alias so component_id/name are derived purely from the support-level string for every level: generally-available -> generally-available-plugins / "Generally-Available Plugins" Now nothing about which levels exist or how they're labeled is hardcoded; the only fixed bit left is SUPPORT_LEVEL_ORDER, which is cosmetic display order and never drops a level. Regenerated codecov.yml and updated the docs accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
component_id_for/component_name_for read $1 directly while every other function in the script assigns its positional params to a named local first. Align them for consistency and readability. No behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|



Summary
Follow-up to #3425. Makes the Codecov support-level components self-update from
rhdh-plugin-export-overlaysmetadata (spec.support) instead of being hand-maintained, so a plugin promoted from e.g. tech-preview → GA is moved to the right component automatically.While wiring this up I found that #3425 hard-coded 70 component paths, but this repo only has 24 workspaces — most of those paths (
workspaces/3scale/,quay/,acr/,backstage/, …) don't exist here; they're overlay workspace names sourced frombackstage/community-pluginsand other upstreams, so Codecov tracked nothing for them. The generated block now contains only the workspaces that actually exist in this repo.Changes
scripts/generate-codecov-components.sh— rewritten:spec.supportfrom overlay metadata and filters to workspaces present in this repo.--write(rewrites only thecomponent_managementblock incodecov.yml, preserving flags/coverage/ignore),--check(exits 1 + diff on drift).--checkis stable; portable across GNU/BSD; shellcheck-clean; back-compatible with the old positional invocation..github/workflows/sync-codecov-components.yml— new:workflow_dispatch: clones the overlay, runs--write, opens a PR when a support level changed (peter-evans/create-pull-request).pull_requestdrift check: runs--checkon PRs touchingcodecov.ymland fails if it's out of sync.RHDH_BOT_TOKEN, harden-runner, and repo-guard conventions.codecov.yml— regenerated to the filtered set (GA 6 / Tech-Preview 4 / Community 3 / Dev-Preview 5 = 18 real paths), dropping paths for non-existent workspaces.docs/codecov-support-levels.md— updated for the automated flow and corrected counts/examples.Verification
--write/--checkall exercised against a real overlay clone;--writeis idempotent; negative drift test exits 1 and pinpoints the path.codecov.ymlremains valid YAML with all existing flags intact.shellcheckclean.Related
🤖 Generated with Claude Code