Skip to content

OCPERT-349: Add job command for running Stage testing prow job#969

Open
tomasdavidorg wants to merge 3 commits into
openshift:mainfrom
tomasdavidorg:OCPERT-349
Open

OCPERT-349: Add job command for running Stage testing prow job#969
tomasdavidorg wants to merge 3 commits into
openshift:mainfrom
tomasdavidorg:OCPERT-349

Conversation

@tomasdavidorg
Copy link
Copy Markdown
Contributor

@tomasdavidorg tomasdavidorg commented Mar 26, 2026

https://redhat.atlassian.net/browse/OCPERT-349

Summary by CodeRabbit

  • New Features

    • Added run_stage_testing command to submit stage-testing jobs using a release payload URL parameter.
    • Added run_image_consistency_check command to validate image consistency with a payload URL and optional merge request ID.
  • Documentation

    • Updated CLI documentation with complete usage examples for both new subcommands and their parameters.

@tomasdavidorg tomasdavidorg requested a review from rioliu-rh March 26, 2026 12:04
@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 26, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Mar 26, 2026

@tomasdavidorg: This pull request references OCPERT-349 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:

https://redhat.atlassian.net/browse/OCPERT-349

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
Copy Markdown

coderabbitai Bot commented Mar 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 79fbabd6-564a-493f-b7ac-d96ac9a2c3a0

📥 Commits

Reviewing files that changed from the base of the PR and between 9feda89 and 2db365a.

📒 Files selected for processing (2)
  • prow/README.md
  • prow/job/job.py
✅ Files skipped from review due to trivial changes (1)
  • prow/README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • prow/job/job.py

Walkthrough

Adds two new CLI docs and implements stage-testing support: payload URL validation, minor-release extraction, Gangway job submission (with timeout), response handling, job ID extraction, and polling for results; exposes run_stage_testing as a Click command.

Changes

Documentation updates

Layer / File(s) Summary
CLI command list and examples
prow/README.md
Normalized spacing of existing commands and added usage/docs/examples for run_stage_testing and run_image_consistency_check, showing -p payload usage, -m/--mr-id for image consistency, and sample job names/IDs/URLs.

Stage-testing and Gangway integration

Layer / File(s) Summary
Constants and timeout
prow/job/job.py
Added Jobs.REQUEST_TIMEOUT = 30 and Jobs.STAGE_TESTING_JOB_NAME_TEMPLATE.
Payload parsing helper
prow/job/job.py
Added Jobs._get_minor_release_from_payload_url(payload_url) to extract the minor release (e.g., 4.19) from a validated payload URL.
Image consistency timeout usage
prow/job/job.py
Applied timeout=self.REQUEST_TIMEOUT to the Gangway post(...) call used by run_image_consistency_check.
Stage-testing flow (submit + poll)
prow/job/job.py
Implemented Jobs.run_stage_testing(payload_url) to validate payload, build a version-specific job name, submit a Gangway POST with RELEASE_IMAGE_LATEST, fail on non-200, extract returned job id, and wait for completion via get_job_results(..., poll=True).
CLI wiring
prow/job/job.py
Added @cli.command("run_stage_testing") Click command with --payload-url option that calls JOB.run_stage_testing(payload_url).

Sequence Diagram

sequenceDiagram
    participant User as CLI User
    participant CLI as Click command
    participant Jobs as Jobs.run_stage_testing
    participant Gangway as Gangway API
    participant Results as get_job_results (poll)

    User->>CLI: invoke run_stage_testing --payload-url
    CLI->>Jobs: run_stage_testing(payload_url)
    Jobs->>Jobs: validate payload, extract minor release, build job name
    Jobs->>Gangway: POST /jobs (RELEASE_IMAGE_LATEST, timeout=30s)
    Gangway-->>Jobs: 200 + { id }
    Jobs->>Results: get_job_results(job_id, poll=true)
    Results->>Gangway: poll job status
    Gangway-->>Results: final job status/result
    Results-->>Jobs: return job result dict
    Jobs-->>CLI: print/return final result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 12
✅ Passed checks (12 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding a job command for running Stage testing prow job, which aligns with the primary code additions (run_stage_testing function and CLI command).
Docstring Coverage ✅ Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed Check not applicable. PR modifies Python code and documentation only. No Ginkgo tests exist in this Python-based project. Ginkgo is a Go testing framework.
Test Structure And Quality ✅ Passed The custom check reviews Ginkgo test code quality. This PR modifies Python code and Markdown documentation only, with no Go test files or Ginkgo tests present. The check is not applicable to this PR.
Microshift Test Compatibility ✅ Passed PR does not add any Ginkgo e2e tests. Changes are Python-only (prow job utilities and documentation). MicroShift compatibility check does not apply to this PR.
Single Node Openshift (Sno) Test Compatibility ✅ Passed This PR modifies Python infrastructure code in prow/job/job.py and README.md. No Ginkgo e2e tests are added, so the check does not apply.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies only CLI tool code and documentation. No deployment manifests, operators, controllers, or scheduling constraints introduced. Check not applicable.
Ote Binary Stdout Contract ✅ Passed OTE check applies to Go/Ginkgo binaries. This PR modifies only Python CLI code. Python print() statements in Click tools are normal operation, not violations.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This PR does not add any Ginkgo e2e tests. It only contains Python CLI code and documentation updates. The check is not applicable.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci openshift-ci Bot requested review from LuboTerifaj and barboras7 March 26, 2026 12:04
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Mar 26, 2026

[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 tomasdavidorg 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

@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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@prow/job/job.py`:
- Around line 440-444: The Gangway POST call at job_run_res =
self._get_session().post(...) has no timeout and can hang; add a timeout kwarg
to the post call (for example timeout=self.request_timeout or timeout=10) so the
request will fail fast on network stalls, and if you choose a configurable value
add a request_timeout attribute (or a constant) to the class and use that in the
call; update the post invocation in job_run_res to include
timeout=<configured_value>.

In `@prow/README.md`:
- Around line 93-97: The README wording "shipment MR" is inconsistent with the
CLI option; update the README example and description for the
run_image_consistency_check command to refer to the merge request ID and the
actual flag name used by the CLI (--mr-id / -m), e.g., change "shipment MR" to
"merge request ID (MR) via -m/--mr-id" and ensure the sample invocation and
explanatory text match the option implemented in the job
run_image_consistency_check command and the CLI option --mr-id in
prow/job/job.py.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 71d18871-07d9-4be6-929c-f57cd920fc02

📥 Commits

Reviewing files that changed from the base of the PR and between 40da513 and 17b5577.

📒 Files selected for processing (2)
  • prow/README.md
  • prow/job/job.py

Comment thread prow/job/job.py
Comment thread prow/README.md Outdated
Comment thread prow/job/job.py
Comment thread prow/job/job.py
Comment thread prow/job/job.py
@tomasdavidorg
Copy link
Copy Markdown
Contributor Author

/retest

@tomasdavidorg tomasdavidorg removed the request for review from barboras7 April 24, 2026 08:05
@tomasdavidorg
Copy link
Copy Markdown
Contributor Author

@LuboTerifaj please take a look

@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented May 13, 2026

@tomasdavidorg: This pull request references OCPERT-349 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 "5.0.0" version, but no target version was set.

Details

In response to this:

https://redhat.atlassian.net/browse/OCPERT-349

Summary by CodeRabbit

  • New Features

  • Added run_stage_testing command to submit stage-testing jobs using a release payload URL parameter.

  • Added run_image_consistency_check command to validate image consistency with a payload URL and optional merge request ID.

  • Documentation

  • Updated CLI documentation with complete usage examples for both new subcommands and their parameters.

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

openshift-ci Bot commented May 13, 2026

@tomasdavidorg: all tests passed!

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.

Comment thread prow/job/job.py
return re.match(pattern, payload_url) is not None


def _get_minor_release_from_payload_url(self, payload_url):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice to have a return type for this method
def _get_minor_release_from_payload_url(self, payload_url: str) -> str:

Comment thread prow/job/job.py
Returns:
A dictionary containing the job info.
"""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like unrelated whitespace change

Comment thread prow/job/job.py

if not self._is_valid_payload_url(payload_url):
raise Exception(f"Invalid payload URL: {payload_url}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As we are adding check for payload_url I think we can also validate mr_id . May be in separate PR.

@jhuttana
Copy link
Copy Markdown
Contributor

@tomasdavidorg Overall changes looks good to me except some minor changes commented above. WDYT about adding unit test for the new functionalities introduced in this PR?
Successfully triggered the command using this PR branch:

$ job run_stage_testing --payload-url quay.io/openshift-release-dev/ocp-release:4.21.15-x86_64
Debug mode is off
Stage testing job name: periodic-ci-openshift-openshift-tests-private-release-4.21-stage-testing-e2e-aws-ipi
Stage testing job id: 12656034-bdcd-4c25-bb46-2aae5124d6fb
Job 12656034-bdcd-4c25-bb46-2aae5124d6fb results: {'jobName': 'periodic-ci-openshift-openshift-tests-private-release-4.21-stage-testing-e2e-aws-ipi', 'payload': None, 'upgrade_from': None, 'upgrade_to': None, 'jobStartTime': '2026-05-15T09:26:46Z', 'jobID': '12656034-bdcd-4c25-bb46-2aae5124d6fb', 'jobURL': 'https://qe-private-deck-ci.apps.ci.l2s4.p1.openshiftapps.com/view/gs/qe-private-deck/logs/periodic-ci-openshift-openshift-tests-private-release-4.21-stage-testing-e2e-aws-ipi/2055218320998666240', 'jobState': 'pending'}
Stage testing job url: https://qe-private-deck-ci.apps.ci.l2s4.p1.openshiftapps.com/view/gs/qe-private-deck/logs/periodic-ci-openshift-openshift-tests-private-release-4.21-stage-testing-e2e-aws-ipi/2055218320998666240

I will update here the status of prow job once it completes.

Thank you !

@jhuttana
Copy link
Copy Markdown
Contributor

The job https://qe-private-deck-ci.apps.ci.l2s4.p1.openshiftapps.com/view/gs/qe-private-deck/logs/periodic-ci-openshift-openshift-tests-private-release-4.21-stage-testing-e2e-aws-ipi/2055218320998666240 is successful.

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

Labels

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