X Tutup
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 and non-RHCOS10 must not.

Detect RHEL 10 by checking the worker MCP's OSImageStream setting, falling back to the cluster-wide default stream from the OSImageStream v1alpha1 singleton when the MCP does not specify one.

Currently we do not have HyperShift/MicroShift RHCOS10 jobs and it is still unknown how to check these clusters. The test will fail if a rhcos10 jobs is added for either of these, forcing us to figure out how to check these clusters.

Another open question is whether we would ever have update jobs that start with rhcos9 and update to rhcos10.

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

Summary by CodeRabbit

  • Tests
    • Added a test that validates CI job names match the cluster OS series (RHEL 10 vs earlier), failing when mismatched.
    • Skips when JOB_NAME is unset or when running on MicroShift where machine configuration/image resources are absent.
    • Auto-detects cluster OS via machine configuration and image stream settings to determine expected job-name fragment.

@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

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds a test that validates job-name suffixes against detected RHEL OS version and a helper that identifies RHEL 10 by inspecting the worker MachineConfigPool's OSImageStream override or the cluster OSImageStreams DefaultStream; skips for MicroShift or missing CRD.

Changes

Cohort / File(s) Summary
OS Version Job Name Validation
test/extended/ci/job_names.go
Adds imports for machineconfig clientset (mcv1client) and k8s API errors (kapierrs). Introduces a new test should match os version that skips when JOB_NAME is unset or cluster is MicroShift, determines RHEL10 via isRHCOS10 (checks worker MCP OSImageStream override or cluster OSImageStreams DefaultStream), treats missing CRD as non-RHEL10, and fails when job name and detected OS mismatch. Adds isRHCOS10 helper function.

Sequence Diagram(s)

sequenceDiagram
    participant TestRunner as Test Runner
    participant Env as ENV (JOB_NAME)
    participant ClusterAPI as Kubernetes API
    participant MCP as MachineConfigPool (worker)
    participant OSIS as OSImageStreams CR

    TestRunner->>Env: read JOB_NAME
    alt JOB_NAME unset
        TestRunner->>TestRunner: skip test
    else
        TestRunner->>ClusterAPI: detect MicroShift
        alt MicroShift
            TestRunner->>TestRunner: skip test
        else
            TestRunner->>MCP: get worker MCP
            MCP-->>TestRunner: MCP.osImageStreamOverride?
            alt override present
                TestRunner->>TestRunner: isRHCOS10 = (override == "rhel-10")
            else
                TestRunner->>OSIS: get singleton OSImageStreams
                alt CRD exists
                    OSIS-->>TestRunner: DefaultStream
                    TestRunner->>TestRunner: isRHCOS10 = (DefaultStream == "rhel-10")
                else
                    OSIS-->>TestRunner: CRD missing
                    TestRunner->>TestRunner: isRHCOS10 = false
                end
            end
            TestRunner->>TestRunner: validate JOB_NAME contains expected "rhcos" fragment
            alt validation fails
                TestRunner->>TestRunner: fail with originalJobName message
            else
                TestRunner->>TestRunner: pass
            end
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Test Structure And Quality ❓ Inconclusive The specific test file could not be accessed to verify test structure quality requirements including single responsibility, setup/cleanup patterns, timeouts, assertions, and codebase consistency. Provide access to test/extended/ci/job_names.go or supply the actual test code content to verify the five quality requirements are met.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title accurately describes the main change: adding OS version validation to the prow job name test, which is the primary focus of the changeset.
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 names in the file, including the newly added test, are stable and deterministic with static, descriptive titles containing no dynamic information.
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

@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

1 similar comment
@petr-muller
Copy link
Member Author

/test images

@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 4, 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/28082b60-17cb-11f1-8193-85564dabd818-0

@petr-muller
Copy link
Member Author

/pipeline required

@openshift-ci-robot
Copy link

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

e2eskipper.Skipf("JOB_NAME env var not set, skipping")
}

isRHCOS10 := machine_config.IsRHEL10(oc.MachineConfigurationClient(), "worker")
Copy link
Contributor

Choose a reason for hiding this comment

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

Having a look at how isRHEL10 is coded the check offer zero warranties of the pool to be running RHEL-10. In fact, the mcp can be perfectly pointing to an empty stream (that's allowed) and be running RHEL 10 if the global cluster stream is RHEL 10.
I suggest to use a different check, like checking the /etc/redhat-release of the nodes or the version reported in, iirc, the Node CR.
@isabella-janssen wrote the original code, any idea?

Copy link
Member

@isabella-janssen isabella-janssen Mar 4, 2026

Choose a reason for hiding this comment

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

Having a look at how isRHEL10 is coded the check offer zero warranties of the pool to be running RHEL-10. In fact, the mcp can be perfectly pointing to an empty stream (that's allowed) and be running RHEL 10 if the global cluster stream is RHEL 10.

I used the OSImageStream check for RHEL10 because this is a temporary function intended to be removed very soon (in OCPBUGS-77002 by next week) and for now I know (unless something has recently changed) that dual streams is being used to set up the RHEL10 env and, thus, the OSImageStream check in the MCP seemed sufficient for my need.

If this logic is to be extended to a more permanent functionality, I think the check could be

flowchart TD
    A[Does the MCP have an OSImageStream value set?]
    A -->|Yes| D[Use the OSImageStream value]
    A -->|No| E[Check the cluster's default image stream]
Loading

or similar. The TLDR is that this function met the immediate need and was intended to be temporary.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! I was also wondering about what is the best way to check RHEL10-ness, was a bit suspicious about the helper too, but wanted to run the change through the jobs to see if it is at least remotely viable. I'll spend more time checking what could be a good approach.

Copy link
Contributor

Choose a reason for hiding this comment

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

@isabella-janssen @petr-muller One possible option is to check the reported OSImageStream status field of the MCPs, that should work is almost all cases (pools fully updated and not degraded).
The change merged yesterday: openshift/machine-config-operator#5689

Copy link
Member Author

Choose a reason for hiding this comment

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

@pablintino I'm wondering whether I even need any MCP-level check at all. The TRT story intent is to make sure job names do match what is being tested, we basically care about cluster level, not individual MCP level. Which made me thought maybe I just need the default from OSImageStreams. But I guess we can have a default 9 there and then have a 10 in the MCP 🤔

Is there any obvious issue with current spec-based form that follows what @isabella-janssen suggested?

@petr-muller petr-muller force-pushed the trt-2506-osversion-validate branch from d700eb6 to 07a05d1 Compare March 4, 2026 16:14
@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 4, 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/4d591770-17e5-11f1-83ae-271a2e285886-0

@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 4, 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
  • New test validates that CI job names accurately correspond to the deployed OS version (RHCOS 10 or RHCOS 9) to prevent environment configuration mismatches during testing.
  • Implements automatic OS version detection by inspecting cluster machine configuration pools and OSImageStream override settings.
  • Intelligently skips validation for MicroShift deployments where required machine configuration resources are unavailable.

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

🤖 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 181-185: Replace the slow exutil.IsMicroShiftCluster probe with a
one-shot ConfigMap existence check: remove the call to
exutil.IsMicroShiftCluster in test/extended/ci/job_names.go and instead perform
a single GET using oc.AdminKubeClient() to check for the MicroShift-specific
ConfigMap (e.g., the known MicroShift configmap in the kube-system namespace);
if the GET returns that the ConfigMap exists treat it as a MicroShift cluster
and call e2eskipper.Skipf("MicroShift clusters do not have MCPs or OSImageStream
resources, skipping"), otherwise continue; keep error handling for the GET and
ensure you do not poll or loop.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: e664c74e-2c77-4afc-9afc-0b2864c89ff6

📥 Commits

Reviewing files that changed from the base of the PR and between d700eb6 and 07a05d1.

📒 Files selected for processing (1)
  • test/extended/ci/job_names.go

@petr-muller
Copy link
Member Author

/pipeline required

@openshift-ci-robot
Copy link

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@openshift-trt
Copy link

openshift-trt bot commented Mar 4, 2026

Risk analysis has seen new tests most likely introduced by this PR.
Please ensure that new tests meet guidelines for naming and stability.

New tests seen in this PR at sha: 07a05d1

  • "[sig-ci] [Early] prow job name should match os version [Suite:openshift/conformance/parallel]" [Total: 8, Pass: 8, Fail: 0, Flake: 0]

@petr-muller petr-muller force-pushed the trt-2506-osversion-validate branch from 07a05d1 to 4918a45 Compare March 5, 2026 16:26
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.

♻️ Duplicate comments (1)
test/extended/ci/job_names.go (1)

186-194: ⚠️ Potential issue | 🟠 Major

RHCOS9 path still allows invalid rhcos* fragments.

The non-RHCOS10 branch currently only rejects rhcos10. Names like ...-rhcos11 or ...-rhcosfoo still pass, which does not enforce the stated rule (“no rhcos* fragment, or exactly rhcos9”).

🐛 Suggested tightening of token validation
 		clusterIsRHCOS10 := isRHCOS10(oc.MachineConfigurationClient())
 		jobIsRHCOS10 := strings.Contains(jobName, "rhcos10")
+		rhcosTokens := make([]string, 0, 1)
+		for _, token := range strings.Split(jobName, "-") {
+			if strings.HasPrefix(token, "rhcos") {
+				rhcosTokens = append(rhcosTokens, token)
+			}
+		}
 
 		if clusterIsRHCOS10 && !jobIsRHCOS10 {
 			e2e.Failf("cluster runs RHCOS10 so job name %q must contain 'rhcos10'", jobName)
 		}
-		if !clusterIsRHCOS10 && jobIsRHCOS10 {
-			e2e.Failf("cluster does not run RHCOS10 so job name %q must not contain 'rhcos10')", jobName)
+		if !clusterIsRHCOS10 {
+			// RHCOS9: no rhcos token, or exactly one rhcos9 token.
+			if len(rhcosTokens) > 1 || (len(rhcosTokens) == 1 && rhcosTokens[0] != "rhcos9") {
+				e2e.Failf("job name %q contains an unexpected rhcos fragment for a cluster running RHCOS9", 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 - 194, The current check only
rejects "rhcos10" but allows other "rhcos*" fragments; update the non-RHCOS10
branch to detect any "rhcos" fragment and fail unless it is exactly "rhcos9".
Replace the simple strings.Contains(jobName, "rhcos10") check with a regexp
search (e.g. match token pattern like `\brhcos[0-9]+\b` or `\brhcos[^\s-]+\b`)
against jobName, then: when clusterIsRHCOS10 (isRHCOS10(...)) require the
matched token == "rhcos10", otherwise if a token exists and token != "rhcos9"
call e2e.Failf with the existing jobName message; reference variables/functions:
jobName, clusterIsRHCOS10, isRHCOS10, and e2e.Failf.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@test/extended/ci/job_names.go`:
- Around line 186-194: The current check only rejects "rhcos10" but allows other
"rhcos*" fragments; update the non-RHCOS10 branch to detect any "rhcos" fragment
and fail unless it is exactly "rhcos9". Replace the simple
strings.Contains(jobName, "rhcos10") check with a regexp search (e.g. match
token pattern like `\brhcos[0-9]+\b` or `\brhcos[^\s-]+\b`) against jobName,
then: when clusterIsRHCOS10 (isRHCOS10(...)) require the matched token ==
"rhcos10", otherwise if a token exists and token != "rhcos9" call e2e.Failf with
the existing jobName message; reference variables/functions: jobName,
clusterIsRHCOS10, isRHCOS10, and e2e.Failf.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: c64571dc-9600-4f9e-9fc4-5f8846c69f39

📥 Commits

Reviewing files that changed from the base of the PR and between 4918a45 and e1be444.

📒 Files selected for processing (1)
  • test/extended/ci/job_names.go

@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 6, 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 and non-RHCOS10 must not.

Detect RHEL 10 by checking the worker MCP's OSImageStream setting, falling back to the cluster-wide default stream from the OSImageStream v1alpha1 singleton when the MCP does not specify one.

Skip the test on MicroShift clusters which do not have MCPs.

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

Summary by CodeRabbit

  • Tests
  • Added a test that validates CI job names match the cluster OS series (RHEL 10 vs earlier), failing when mismatched.
  • Skips when JOB_NAME is unset or when running on MicroShift where machine configuration/image resources are absent.
  • Auto-detects cluster OS via machine configuration and image stream settings to determine expected job-name fragment.

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.

♻️ Duplicate comments (1)
test/extended/ci/job_names.go (1)

186-194: ⚠️ Potential issue | 🟠 Major

Non-RHCOS10 validation is too permissive for rhcos* fragments.

On Line 192-Line 193, the check only rejects rhcos10. It still allows invalid tokens like rhcos11, while the rule is “no rhcos* token or exactly rhcos9” for non-RHCOS10 clusters.

🐛 Proposed fix
 		clusterIsRHCOS10 := isRHCOS10(oc.MachineConfigurationClient())
-		jobIsRHCOS10 := strings.Contains(jobName, "rhcos10")
+		rhcosTokens := make([]string, 0, 1)
+		for _, token := range strings.Split(jobName, "-") {
+			if strings.HasPrefix(token, "rhcos") {
+				rhcosTokens = append(rhcosTokens, token)
+			}
+		}

-		if clusterIsRHCOS10 && !jobIsRHCOS10 {
-			e2e.Failf("cluster runs RHCOS10 so job name %q must contain 'rhcos10'", jobName)
-		}
-		if !clusterIsRHCOS10 && jobIsRHCOS10 {
-			e2e.Failf("cluster does not run RHCOS10 so job name %q must not contain 'rhcos10')", jobName)
+		if clusterIsRHCOS10 {
+			hasRHCOS10 := false
+			for _, token := range rhcosTokens {
+				if token == "rhcos10" {
+					hasRHCOS10 = true
+					break
+				}
+			}
+			if !hasRHCOS10 {
+				e2e.Failf("cluster runs RHCOS10 so job name %q must contain 'rhcos10'", jobName)
+			}
+		} else {
+			if len(rhcosTokens) > 1 || (len(rhcosTokens) == 1 && rhcosTokens[0] != "rhcos9") {
+				e2e.Failf("cluster does not run RHCOS10 so job name %q contains an unexpected rhcos fragment", jobName)
+			}
 		}
🤖 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 - 194, The current validation
only detects "rhcos10" (jobIsRHCOS10) but permits other rhcos tokens (e.g.,
"rhcos11"); change the detection to look for any rhcos<N> token (use a regex or
token scan on jobName, e.g. match `\brhcos(\d+)\b`) and then enforce: if
clusterIsRHCOS10 then require the token equals "rhcos10", and if
!clusterIsRHCOS10 then reject any rhcos token except allow exactly "rhcos9".
Update the logic around isRHCOS10(oc.MachineConfigurationClient()), jobName and
the checks that call e2e.Failf() to use this stricter rhcos token matching and
comparison.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@test/extended/ci/job_names.go`:
- Around line 186-194: The current validation only detects "rhcos10"
(jobIsRHCOS10) but permits other rhcos tokens (e.g., "rhcos11"); change the
detection to look for any rhcos<N> token (use a regex or token scan on jobName,
e.g. match `\brhcos(\d+)\b`) and then enforce: if clusterIsRHCOS10 then require
the token equals "rhcos10", and if !clusterIsRHCOS10 then reject any rhcos token
except allow exactly "rhcos9". Update the logic around
isRHCOS10(oc.MachineConfigurationClient()), jobName and the checks that call
e2e.Failf() to use this stricter rhcos token matching and comparison.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 5d3f078d-3b3f-4517-b520-6ad620478663

📥 Commits

Reviewing files that changed from the base of the PR and between e1be444 and 4abb04c.

📒 Files selected for processing (1)
  • test/extended/ci/job_names.go

@petr-muller
Copy link
Member Author

/payload-job periodic-ci-openshift-hypershift-release-4.22-periodics-e2e-aws-ovn-conformance kubernetes logo
periodic-ci-openshift-hypershift-release-4.22-periodics-e2e-aws-ovn

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 6, 2026

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

  • periodic-ci-openshift-hypershift-release-4.22-periodics-e2e-aws-ovn-conformance

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/726e5cf0-1966-11f1-9fd1-f13f9d24b5c1-0

@petr-muller
Copy link
Member Author

/payload-job periodic-ci-openshift-hypershift-release-4.22-periodics-e2e-aws-ovn

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 6, 2026

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

  • periodic-ci-openshift-hypershift-release-4.22-periodics-e2e-aws-ovn

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/a41eda40-1966-11f1-98bd-c5ae76f44315-0

@petr-muller
Copy link
Member Author

/test ?

@petr-muller
Copy link
Member Author

/test e2e-hypershift-conformance

@petr-muller
Copy link
Member Author

/test ?

@petr-muller
Copy link
Member Author

/test e2e-aws-ovn-single-node-upgrade

@openshift-trt
Copy link

openshift-trt bot commented Mar 6, 2026

Risk analysis has seen new tests most likely introduced by this PR.
Please ensure that new tests meet guidelines for naming and stability.

New Test Risks for sha: 4abb04c

Job Name New Test Risk
pull-ci-openshift-origin-main-e2e-hypershift-conformance High - "[sig-ci] [Early] prow job name should match os version [Suite:openshift/conformance/parallel]" is a new test that failed 1 time(s) against the current commit

New tests seen in this PR at sha: 4abb04c

  • "[sig-ci] [Early] prow job name should match os version [Suite:openshift/conformance/parallel]" [Total: 9, Pass: 8, Fail: 1, Flake: 0]

@openshift-trt
Copy link

openshift-trt bot commented Mar 6, 2026

Risk analysis has seen new tests most likely introduced by this PR.
Please ensure that new tests meet guidelines for naming and stability.

New Test Risks for sha: 4abb04c

Job Name New Test Risk
pull-ci-openshift-origin-main-e2e-hypershift-conformance High - "[sig-ci] [Early] prow job name should match os version [Suite:openshift/conformance/parallel]" is a new test that failed 1 time(s) against the current commit

New tests seen in this PR at sha: 4abb04c

  • "[sig-ci] [Early] prow job name should match os version [Suite:openshift/conformance/parallel]" [Total: 10, Pass: 9, Fail: 1, Flake: 0]

@petr-muller petr-muller force-pushed the trt-2506-osversion-validate branch from 4abb04c to bfe2752 Compare March 9, 2026 17:05
@petr-muller
Copy link
Member Author

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

/test e2e-aws-ovn-single-node-upgrade
/test e2e-hypershift-conformance

@petr-muller
Copy link
Member Author

/test ?

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 9, 2026

@petr-muller: trigger 3 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
  • periodic-ci-openshift-hypershift-release-4.22-periodics-e2e-aws-ovn
  • periodic-ci-openshift-hypershift-release-4.22-periodics-e2e-aws-ovn-conformance

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/65402880-1bda-11f1-95e0-b8d60e1f1fcc-0

@openshift-ci-robot
Copy link

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@petr-muller petr-muller force-pushed the trt-2506-osversion-validate branch from bfe2752 to 2024332 Compare March 9, 2026 19:33
@petr-muller
Copy link
Member Author

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

/test e2e-aws-ovn-single-node-upgrade
/test e2e-hypershift-conformance

/pipeline required

@openshift-ci-robot
Copy link

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 9, 2026

@petr-muller: trigger 3 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
  • periodic-ci-openshift-hypershift-release-4.22-periodics-e2e-aws-ovn
  • periodic-ci-openshift-hypershift-release-4.22-periodics-e2e-aws-ovn-conformance

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/80787e30-1bef-11f1-97b2-b244f75538a3-0

Ensure CI job names reflect the node OS version: RHCOS 10 clusters must
have "rhcos10" in the job name and non-RHCOS10 must not.

Detect RHEL 10 by checking the worker MCP's OSImageStream setting,
falling back to the cluster-wide default stream from the OSImageStream
v1alpha1 singleton when the MCP does not specify one.

Currently we do not have HyperShift/MicroShift RHCOS10 jobs and it is
still unknown how to check these clusters. The test will fail if a
rhcos10 jobs is added for either of these, forcing us to figure out how
to check these clusters.

Another open question is whether we would ever have update jobs that
start with rhcos9 and update to rhcos10.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@petr-muller petr-muller force-pushed the trt-2506-osversion-validate branch from 2024332 to b82c27e Compare March 9, 2026 22:12
@petr-muller
Copy link
Member Author

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

/test e2e-aws-ovn-single-node-upgrade
/test e2e-hypershift-conformance

/pipeline required

@openshift-ci-robot
Copy link

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 9, 2026

@petr-muller: trigger 3 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
  • periodic-ci-openshift-hypershift-release-4.22-periodics-e2e-aws-ovn
  • periodic-ci-openshift-hypershift-release-4.22-periodics-e2e-aws-ovn-conformance

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/16969ea0-1c05-11f1-921b-3f284e6414ea-0

@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 9, 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 and non-RHCOS10 must not.

Detect RHEL 10 by checking the worker MCP's OSImageStream setting, falling back to the cluster-wide default stream from the OSImageStream v1alpha1 singleton when the MCP does not specify one.

Currently we do not have HyperShift/MicroShift RHCOS10 jobs and it is still unknown how to check these clusters. The test will fail if a rhcos10 jobs is added for either of these, forcing us to figure out how to check these clusters.

Another open question is whether we would ever have update jobs that start with rhcos9 and update to rhcos10.

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

Summary by CodeRabbit

  • Tests
  • Added a test that validates CI job names match the cluster OS series (RHEL 10 vs earlier), failing when mismatched.
  • Skips when JOB_NAME is unset or when running on MicroShift where machine configuration/image resources are absent.
  • Auto-detects cluster OS via machine configuration and image stream settings to determine expected job-name fragment.

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-trt
Copy link

openshift-trt bot commented Mar 10, 2026

Risk analysis has seen new tests most likely introduced by this PR.
Please ensure that new tests meet guidelines for naming and stability.

New Test Risks for sha: b82c27e

Job Name New Test Risk
pull-ci-openshift-origin-main-e2e-vsphere-ovn Medium - "[sig-ci] [Early] prow job name should match os version [Suite:openshift/conformance/parallel]" is a new test, and was only seen in one job.

New tests seen in this PR at sha: b82c27e

  • "[sig-ci] [Early] prow job name should match os version [Suite:openshift/conformance/parallel]" [Total: 1, Pass: 1, Fail: 0, Flake: 0]

@openshift-trt
Copy link

openshift-trt bot commented Mar 10, 2026

Risk analysis has seen new tests most likely introduced by this PR.
Please ensure that new tests meet guidelines for naming and stability.

New tests seen in this PR at sha: b82c27e

  • "[sig-ci] [Early] prow job name should match os version [Suite:openshift/conformance/parallel]" [Total: 9, Pass: 9, Fail: 0, Flake: 0]

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.

4 participants

X Tutup