Skip to content

push-test-metrics: derive job names from prow config instead of hard-coding#4806

Open
Jaydeep869 wants to merge 2 commits into
kubevirt:mainfrom
Jaydeep869:fix/push-test-metrics-derive-job-names-from-config
Open

push-test-metrics: derive job names from prow config instead of hard-coding#4806
Jaydeep869 wants to merge 2 commits into
kubevirt:mainfrom
Jaydeep869:fix/push-test-metrics-derive-job-names-from-config

Conversation

@Jaydeep869
Copy link
Copy Markdown

What this PR does / why we need it:

The push-test-metrics robot has a hard coded list of periodic job names stuck at k8s 1.29. Since those lanes no longer exist, the robot scans stale GCS paths and pushes incorrect metrics to the Grafana dashboard.

This PR replaces the hard-coded default with dynamic discovery from the prow periodics job config YAML using config.ReadJobConfig. It selects the latest k8s version for each of the four main SIG lanes (compute, storage, network, operator) automatically.

Additionally fixes the jobNames.Set() method which was silently discarding values, making the existing --job-name flag non-functional.

Which issue(s) this PR fixes
Fixes #4802

Special notes for your reviewer:

  • The regex intentionally matches only the four main SIG lanes (sig-compute, sig-storage, sig-network, sig-operator) and excludes variant lanes like -migrations, -root, -performance, ipv6- to preserve the original dashboard scope.
  • The three copies of kubevirt-periodics.yaml (config/, jobs/, github/ci/prow-deploy/files/) are hardlinked to the same inode, so the single file edit covers all three.
  • --job-name flags still work as a manual override if specified.

Checklist

This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.

Release note:

NONE

Copilot AI review requested due to automatic review settings March 9, 2026 17:01
@kubevirt-bot kubevirt-bot added the dco-signoff: yes Indicates the PR's author has DCO signed all their commits. label Mar 9, 2026
@kubevirt-bot
Copy link
Copy Markdown
Contributor

Hi @Jaydeep869. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubevirt-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign vladikr for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Copy Markdown

@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 log.Infof("derived job names from config: %s", jobNamesToScan) call will not compile because jobNames is a []string, %s expects a string, and the type does not implement fmt.Stringer for the value receiver; either use %v, call jobNamesToScan.String(), or adjust the String method to be on the value receiver and use %s with that.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `log.Infof("derived job names from config: %s", jobNamesToScan)` call will not compile because `jobNames` is a `[]string`, `%s` expects a string, and the type does not implement `fmt.Stringer` for the value receiver; either use `%v`, call `jobNamesToScan.String()`, or adjust the `String` method to be on the value receiver and use `%s` with that.

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.

…coding

Replace the hard-coded list of periodic job names (stuck at k8s 1.29)
with dynamic discovery from the prow periodics job config YAML using
config.ReadJobConfig.

- Add --job-config-path flag to read the periodics config
- Add readJobNamesFromConfig() that parses the config and selects the
  latest k8s version for each main SIG lane (compute, storage, network,
  operator) using numeric version comparison
- Fix the jobNames.Set() method which was silently discarding values,
  making the --job-name flag non-functional
- Use pointer receiver on jobNames so flag.Var works correctly
- Require either --job-name or --job-config-path (no more silent fallback
  to stale names)
- Update periodic job YAML to pass --job-config-path
- Add unit tests

Fixes: kubevirt#4802
Signed-off-by: jaydeep869 <jaydeeppokhariya2106@gmail.com>
@Jaydeep869 Jaydeep869 force-pushed the fix/push-test-metrics-derive-job-names-from-config branch from 65c1157 to 8191105 Compare March 9, 2026 17:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes push-test-metrics producing stale/incorrect Grafana metrics by replacing the hard-coded periodic job list with dynamic discovery from the Prow periodics job config (selecting the latest k8s version per main SIG lane), and by repairing the broken --job-name flag parsing.

Changes:

  • Add readJobNamesFromConfig() which loads the Prow job config YAML via config.ReadJobConfig and derives the latest job per main SIG lane.
  • Fix jobNames.Set() so repeated --job-name flags actually accumulate values.
  • Update the Prow periodic job definition to pass --job-config-path, and add unit tests for the new config parsing and flag behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
robots/push-test-metrics/main.go Implements dynamic job discovery from Prow config and fixes the --job-name flag handling.
robots/push-test-metrics/main_test.go Adds unit tests for derived job selection, filtering, error handling, and jobNames flag behavior.
github/ci/prow-deploy/files/jobs/kubevirt/kubevirt/kubevirt-periodics.yaml Updates the periodic invocation to provide --job-config-path for discovery.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread robots/push-test-metrics/main.go
Comment thread robots/push-test-metrics/main.go
Comment thread robots/push-test-metrics/main.go
@brianmcarey
Copy link
Copy Markdown
Member

/test all

@Jaydeep869
Copy link
Copy Markdown
Author

@brianmcarey Can you also review the pr as it need lgtm/approve label for all checks to pass.

@kubevirt-bot
Copy link
Copy Markdown
Contributor

There has been no activity on this PR for 45 days.
To protect limited CI resources, it has been automatically labelled 'stale'.
This PR will automatically rot after an additional 14 days of inactivity, and will be closed shortly after that.

What you can do:

  • If the PR is waiting on you to respond to a question or feedback and/or update the PR, please do so.
  • You can mark the PR as fresh and remove the label with the following command: /remove-lifecycle stale
  • If this PR is safe to close now, please help the project by closing it with: /close
  • If you need attention on this PR from a reviewer, you can raise it on the agenda of the relevant SIG meeting or KubeVirt Community meeting, or ping the kubevirt-dev slack channel.

/lifecycle stale

@kubevirt-bot kubevirt-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

push-test-metrics: hard coded periodic names

4 participants