Skip to content

TRT-2506: Add OS version validation to prow job name test#30826

Open
petr-muller wants to merge 1 commit intoopenshift:mainfrom
petr-muller:trt-2506-osversion-validate
Open

TRT-2506: Add OS version validation to prow job name test#30826
petr-muller wants to merge 1 commit intoopenshift:mainfrom
petr-muller:trt-2506-osversion-validate

Conversation

@petr-muller
Copy link
Member

@petr-muller petr-muller commented Mar 3, 2026

Ensure CI job names reflect the node OS version: RHCOS 10 clusters must have "rhcos10" in the job name, while RHCOS 9 clusters must have no "rhcos*" fragment or exactly "rhcos9".

Export IsRHEL10 from machine_config helpers (accepting the Interface type) so it can be called from the ci package.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Summary by CodeRabbit

  • Tests
    • Added test case to verify OS version matching for RHEL 10 detection
    • Updated helper function to improve testing compatibility with machine configuration clients

Ensure CI job names reflect the node OS version: RHCOS 10 clusters must
have "rhcos10" in the job name, while RHCOS 9 clusters must have no
"rhcos*" fragment or exactly "rhcos9".

Export IsRHEL10 from machine_config helpers (accepting the Interface type)
so it can be called from the ci package.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-ci-robot
Copy link

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 3, 2026
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 3, 2026

@petr-muller: This pull request references TRT-2506 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Ensure CI job names reflect the node OS version: RHCOS 10 clusters must
have "rhcos10" in the job name, while RHCOS 9 clusters must have no
"rhcos*" fragment or exactly "rhcos9".

Export IsRHEL10 from machine_config helpers (accepting the Interface type)
so it can be called from the ci package.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 3, 2026

@petr-muller: This pull request references TRT-2506 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Ensure CI job names reflect the node OS version: RHCOS 10 clusters must have "rhcos10" in the job name, while RHCOS 9 clusters must have no "rhcos*" fragment or exactly "rhcos9".

Export IsRHEL10 from machine_config helpers (accepting the Interface type) so it can be called from the ci package.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link

coderabbitai bot commented Mar 3, 2026

Walkthrough

The changes introduce a new test case for validating OS version matching in job names and update the public API signature of the IsRHEL10 helper function to accept an interface type instead of a concrete pointer type for improved abstraction.

Changes

Cohort / File(s) Summary
New OS Version Test Case
test/extended/ci/job_names.go
Adds a new test case that validates job names contain appropriate RHCOS version fragments based on detected OS version using the IsRHEL10 function, with conditional logic for RHEL 10 versus RHEL 9.
Helper Function API Update
test/extended/machine_config/helpers.go
Updates the exported IsRHEL10 function signature to accept machineconfigclient.Interface instead of *machineconfigclient.Clientset, changing the public API surface to use an interface type for client access.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning Test combines multiple validation behaviors in a single test case and uses overly permissive substring matching for RHCOS 9 validation instead of token-based validation. Split validation logic into separate test cases and implement token-based validation to ensure exact job name semantics matching the cluster's OS version.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding OS version validation to a prow job name test, which aligns with the primary objective of validating CI job names reflect node OS versions.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Stable And Deterministic Test Names ✅ Passed All test titles are static, descriptive strings with no dynamic values like pod names, timestamps, UUIDs, node names, namespace names, or IP addresses.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@petr-muller
Copy link
Member Author

/test ?

@openshift-ci openshift-ci bot requested review from deads2k and pablintino March 3, 2026 12:09
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 3, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: petr-muller

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

The pull request process is described 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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 3, 2026
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 3, 2026

@petr-muller: This pull request references TRT-2506 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Ensure CI job names reflect the node OS version: RHCOS 10 clusters must have "rhcos10" in the job name, while RHCOS 9 clusters must have no "rhcos*" fragment or exactly "rhcos9".

Export IsRHEL10 from machine_config helpers (accepting the Interface type) so it can be called from the ci package.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Summary by CodeRabbit

  • Tests
  • Added test case to verify OS version matching for RHEL 10 detection
  • Updated helper function to improve testing compatibility with machine configuration clients

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 openshift-eng/jira-lifecycle-plugin repository.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/extended/machine_config/helpers.go (1)

167-168: Consider aligning skipOnRHEL10BeforeMar11 with the same interface type.

This helper still takes *machineconfigclient.Clientset; using machineconfigclient.Interface here would keep the helper APIs consistent.

♻️ Suggested consistency refactor
-func skipOnRHEL10BeforeMar11(machineConfigClient *machineconfigclient.Clientset, mcpName string) {
+func skipOnRHEL10BeforeMar11(machineConfigClient machineconfigclient.Interface, mcpName string) {
 	if IsRHEL10(machineConfigClient, mcpName) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/extended/machine_config/helpers.go` around lines 167 - 168, The helper
skipOnRHEL10BeforeMar11 currently accepts a concrete
*machineconfigclient.Clientset; change its first parameter to the interface
machineconfigclient.Interface to match the other helpers and keep the API
consistent, and update any calls passing a Clientset (which already implements
machineconfigclient.Interface) to continue to work; ensure the IsRHEL10 function
signature is compatible (it accepts machineconfigclient.Interface) and adjust
imports if needed so skipOnRHEL10BeforeMar11(machineconfigclient.Interface,
mcpName string) compiles.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/extended/ci/job_names.go`:
- Around line 186-188: The current substring check on jobName is too permissive;
update the logic in the validation block (the code that reads jobName and
originalJobName) to split jobName into tokens (e.g., strings.Split(jobName,
"-")) and then enforce that no token begins with "rhcos" unless that token is
exactly "rhcos9"; if any token startsWith "rhcos" and != "rhcos9" call e2e.Failf
with the same message using originalJobName. This ensures only an exact "rhcos9"
token is allowed and mixed/extended fragments are rejected.

---

Nitpick comments:
In `@test/extended/machine_config/helpers.go`:
- Around line 167-168: The helper skipOnRHEL10BeforeMar11 currently accepts a
concrete *machineconfigclient.Clientset; change its first parameter to the
interface machineconfigclient.Interface to match the other helpers and keep the
API consistent, and update any calls passing a Clientset (which already
implements machineconfigclient.Interface) to continue to work; ensure the
IsRHEL10 function signature is compatible (it accepts
machineconfigclient.Interface) and adjust imports if needed so
skipOnRHEL10BeforeMar11(machineconfigclient.Interface, mcpName string) compiles.

ℹ️ Review info

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 84df1a9 and d700eb6.

📒 Files selected for processing (2)
  • test/extended/ci/job_names.go
  • test/extended/machine_config/helpers.go

Comment on lines +186 to +188
// RHCOS 9: must have no rhcos fragment at all, or exactly rhcos9
if strings.Contains(jobName, "rhcos") && !strings.Contains(jobName, "rhcos9") {
e2e.Failf("job name %q contains an unexpected rhcos fragment for a cluster running RHCOS 9", originalJobName)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

RHCOS 9 validation is too permissive and can miss invalid names.

The current substring logic allows invalid cases (for example mixed or extended fragments) while the requirement is “no rhcos* fragment or exactly rhcos9.”

🐛 Suggested fix to enforce exact RHCOS 9 token semantics
 	isRHCOS10 := machine_config.IsRHEL10(oc.MachineConfigurationClient(), "worker")
+	rhcosTokens := make([]string, 0, 1)
+	for _, token := range strings.Split(jobName, "-") {
+		if strings.HasPrefix(token, "rhcos") {
+			rhcosTokens = append(rhcosTokens, token)
+		}
+	}
 
 	if isRHCOS10 {
 		if !strings.Contains(jobName, "rhcos10") {
 			e2e.Failf("job name %q does not contain rhcos10 but cluster is running RHCOS 10", originalJobName)
 		}
 	} else {
-		// RHCOS 9: must have no rhcos fragment at all, or exactly rhcos9
-		if strings.Contains(jobName, "rhcos") && !strings.Contains(jobName, "rhcos9") {
+		// RHCOS 9: must have no rhcos fragment, or exactly one rhcos9 fragment.
+		if len(rhcosTokens) > 1 || (len(rhcosTokens) == 1 && rhcosTokens[0] != "rhcos9") {
 			e2e.Failf("job name %q contains an unexpected rhcos fragment for a cluster running RHCOS 9", originalJobName)
 		}
 	}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/extended/ci/job_names.go` around lines 186 - 188, The current substring
check on jobName is too permissive; update the logic in the validation block
(the code that reads jobName and originalJobName) to split jobName into tokens
(e.g., strings.Split(jobName, "-")) and then enforce that no token begins with
"rhcos" unless that token is exactly "rhcos9"; if any token startsWith "rhcos"
and != "rhcos9" call e2e.Failf with the same message using originalJobName. This
ensures only an exact "rhcos9" token is allowed and mixed/extended fragments are
rejected.

@petr-muller
Copy link
Member Author

/payload-job periodic-ci-openshift-release-main-ci-4.22-e2e-azure-ovn-rhcos10-techpreview-serial

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 3, 2026

@petr-muller: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-ci-4.22-e2e-azure-ovn-rhcos10-techpreview-serial

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/9ed573a0-16fa-11f1-9002-4371b3a38667-0

@petr-muller
Copy link
Member Author

/test images

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 3, 2026

@petr-muller: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/images d700eb6 link true /test images

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants