Skip to content

Conversation

@wainersm
Copy link
Contributor

@wainersm wainersm commented Oct 3, 2025

Made a major refactor of create-prowjob-commands.sh to also allow to trigger jobs using the Prow API.

Here is the new usage of the script:

Usage: ./sandboxed-containers-operator-create-prowjob-commands.sh <command>

Commands:
  create  Generate prowjob configuration files
  run     Run prowjobs from YAML configuration

Examples:
  ./sandboxed-containers-operator-create-prowjob-commands.sh create
  ./sandboxed-containers-operator-create-prowjob-commands.sh run /path/to/job_yaml.yaml
  ./sandboxed-containers-operator-create-prowjob-commands.sh run /path/to/job_yaml.yaml azure-ipi-kata

Environment variables for 'create' command:
  OCP_VERSION                    - OpenShift version (default: 4.19)
  TEST_RELEASE_TYPE              - Test release type: Pre-GA or GA (default: Pre-GA)
  EXPECTED_OSC_VERSION           - Expected OSC version (default: 1.10.1)
  INSTALL_KATA_RPM               - Install Kata RPM: true or false (default: true)
  KATA_RPM_VERSION               - Kata RPM version (default: 3.17.0-3.rhaos4.19.el9)
  SLEEP_DURATION                 - Sleep duration after tests (default: 0h)
  TEST_SCENARIOS                 - Test scenarios filter (default: sig-kata.*Kata Author)
  TEST_TIMEOUT                   - Test timeout in minutes (default: 90)
  ENABLE_MUST_GATHER             - Enable must-gather: true or false (default: true)
  MUST_GATHER_IMAGE              - Must-gather image (default: registry.redhat.io/openshift-sandboxed-containers/osc-must-gather-rhel9:latest)
  MUST_GATHER_ON_FAILURE_ONLY    - Must-gather on failure only: true or false (default: true)
  AWS_REGION_OVERRIDE            - AWS region (default: us-east-2)
  CUSTOM_AZURE_REGION            - Azure region (default: eastus)
  OSC_CATALOG_TAG                - OSC catalog tag (auto-detected if not provided)
  TRUSTEE_CATALOG_TAG            - Trustee catalog tag (auto-detected if not provided)

@openshift-ci openshift-ci bot requested review from ldoktor and tbuskey October 3, 2025 19:59
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 3, 2025
@openshift-ci-robot
Copy link
Contributor

@wainersm, pj-rehearse: unable to determine affected jobs. This could be due to a branch that needs to be rebased. ERROR:

could not determine changed registry steps: could not load step registry: file /var/tmp/gitrepo42734708/ci-operator/step-registry/sandboxed-containers-operator/create-prowjob/lib.sh has incorrect prefix. Prefix should be sandboxed-containers-operator-create-prowjob
Interacting with pj-rehearse

Comment: /pj-rehearse to run up to 5 rehearsals
Comment: /pj-rehearse skip to opt-out of rehearsals
Comment: /pj-rehearse {test-name}, with each test separated by a space, to run one or more specific rehearsals
Comment: /pj-rehearse more to run up to 10 rehearsals
Comment: /pj-rehearse max to run up to 25 rehearsals
Comment: /pj-rehearse auto-ack to run up to 5 rehearsals, and add the rehearsals-ack label on success
Comment: /pj-rehearse list to get an up-to-date list of affected jobs
Comment: /pj-rehearse abort to abort all active rehearsals
Comment: /pj-rehearse network-access-allowed to allow rehearsals of tests that have the restrict_network_access field set to false. This must be executed by an openshift org member who is not the PR author

Once you are satisfied with the results of the rehearsals, comment: /pj-rehearse ack to unblock merge. When the rehearsals-ack label is present on your PR, merge will no longer be blocked by rehearsals.
If you would like the rehearsals-ack label removed, comment: /pj-rehearse reject to re-block merging.

Copy link
Contributor

@tbuskey tbuskey left a comment

Choose a reason for hiding this comment

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

Looks good

echo ""
echo "Triggering jobs..."

API_ENDPOINT="https://gangway-ci.apps.ci.l2s4.p1.openshiftapps.com/v1/executions"
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this ever change?

Copy link
Contributor

Choose a reason for hiding this comment

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

Very good question, I'd suggest moving this at the beginning of the file (or at least function) to simplify changing this value if needed (along with short comment explaining where to get the value from)

DO NOT EDIT DIRECTLY.
This is generated by the sandboxed-containers-operator-create-prowjob-commands.sh script.
# DO NOT EDIT DIRECTLY.
# This is generated by the sandboxed-containers-operator-create-prowjob-commands.sh script.
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch, documentation is only supported for steps/workflows and such, not the generated jobs.

# script to create prowjobs in ci-operator/config/openshift/sandboxed-containers-operator using environment variables.
# Usage: ./sandboxed-containers-operator-create-prowjob-commands.sh
# Usage:
# ./sandboxed-containers-operator-create-prowjob-commands.sh gen # Generate prowjob configuration
Copy link
Contributor

@ldoktor ldoktor Oct 7, 2025

Choose a reason for hiding this comment

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

This should be "create" and not "gen"

@@ -0,0 +1,99 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

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

Unless something changed prow doesn't allow other files than $prefix-$tool (so only sandboxed-containers-operator-create-prowjob-commands.sh and such). So I don't think we can create a lib here.

Copy link
Contributor

Choose a reason for hiding this comment

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

(I struggled with this with upstream as well so if that changed I'm all in)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately it doesn't. I will need to delete the lib.sh file and return the functions to the script :(

@wainersm wainersm force-pushed the create-prowjob_trigger branch from 696fdb3 to 9ad2c9a Compare October 7, 2025 19:21
@wainersm
Copy link
Contributor Author

wainersm commented Oct 7, 2025

@tbuskey @ldoktor in this updated version I think I address all your comments. Please could you review again?

@openshift-ci-robot openshift-ci-robot added the rehearsals-ack Signifies that rehearsal jobs have been acknowledged label Oct 7, 2025
…defaults() in create-prowjob-commands.sh

- Extract parameter validation and default setting logic into validate_and_set_defaults() function
- Maintain all existing validation rules and error handling

Assisted-by: Cursor
Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
…eate-prowjob-commands.sh

- Refactor script to support command-based interface
- Add 'create' command to generate prowjob configurations
- Move existing functionality into command_create() function
- Add proper command validation and usage help
- Maintain all existing functionality with improved structure

Assisted-by: Cursor
Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
…e-prowjob-commands.sh

- Add 'run' command as placeholder for future prowjob execution
- Update usage help to include run command
- Add command_run() function with unimplemented message
- Maintain backward compatibility with create command

Assisted-by: Cursor
Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
…rom generated prowjob

The documentation section in the generated prowjob is not valid for the
ci-operator, resulting on job run via API to fail.

Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
@wainersm wainersm force-pushed the create-prowjob_trigger branch from 9ad2c9a to fc1e75f Compare October 13, 2025 16:42
@wainersm
Copy link
Contributor Author

Rebased and fixed a shellcheck warn.

@openshift-ci-robot
Copy link
Contributor

[REHEARSALNOTIFIER]
@wainersm: no rehearsable tests are affected by this change

Interacting with pj-rehearse

Comment: /pj-rehearse to run up to 5 rehearsals
Comment: /pj-rehearse skip to opt-out of rehearsals
Comment: /pj-rehearse {test-name}, with each test separated by a space, to run one or more specific rehearsals
Comment: /pj-rehearse more to run up to 10 rehearsals
Comment: /pj-rehearse max to run up to 25 rehearsals
Comment: /pj-rehearse auto-ack to run up to 5 rehearsals, and add the rehearsals-ack label on success
Comment: /pj-rehearse list to get an up-to-date list of affected jobs
Comment: /pj-rehearse abort to abort all active rehearsals
Comment: /pj-rehearse network-access-allowed to allow rehearsals of tests that have the restrict_network_access field set to false. This must be executed by an openshift org member who is not the PR author

Once you are satisfied with the results of the rehearsals, comment: /pj-rehearse ack to unblock merge. When the rehearsals-ack label is present on your PR, merge will no longer be blocked by rehearsals.
If you would like the rehearsals-ack label removed, comment: /pj-rehearse reject to re-block merging.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 13, 2025

@wainersm: all tests passed!

Full PR test history. Your PR dashboard.

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.

@tbuskey
Copy link
Contributor

tbuskey commented Oct 14, 2025

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 14, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 14, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tbuskey, wainersm

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

The pull request process is described here

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-merge-bot openshift-merge-bot bot merged commit 7ee2fdf into openshift:master Oct 14, 2025
10 checks passed
tbuskey pushed a commit to tbuskey/release that referenced this pull request Oct 14, 2025
…ands.sh to run jobs (openshift#69967)

* step-registry/sandboxed-containers-operator: create validate_and_set_defaults() in create-prowjob-commands.sh

- Extract parameter validation and default setting logic into validate_and_set_defaults() function
- Maintain all existing validation rules and error handling

Assisted-by: Cursor
Signed-off-by: Wainer dos Santos Moschetta <[email protected]>

* step-registry/sandboxed-containers-operator: Add create command to create-prowjob-commands.sh

- Refactor script to support command-based interface
- Add 'create' command to generate prowjob configurations
- Move existing functionality into command_create() function
- Add proper command validation and usage help
- Maintain all existing functionality with improved structure

Assisted-by: Cursor
Signed-off-by: Wainer dos Santos Moschetta <[email protected]>

* step-registry/sandboxed-containers-operator: Add run command to create-prowjob-commands.sh

- Add 'run' command as placeholder for future prowjob execution
- Update usage help to include run command
- Add command_run() function with unimplemented message
- Maintain backward compatibility with create command

Assisted-by: Cursor
Signed-off-by: Wainer dos Santos Moschetta <[email protected]>

* step-registry/sandboxed-containers-operator: Remove "documentation" from generated prowjob

The documentation section in the generated prowjob is not valid for the
ci-operator, resulting on job run via API to fail.

Signed-off-by: Wainer dos Santos Moschetta <[email protected]>

---------

Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
abhay-nutanix pushed a commit to abhay-nutanix/release that referenced this pull request Oct 16, 2025
…ands.sh to run jobs (openshift#69967)

* step-registry/sandboxed-containers-operator: create validate_and_set_defaults() in create-prowjob-commands.sh

- Extract parameter validation and default setting logic into validate_and_set_defaults() function
- Maintain all existing validation rules and error handling

Assisted-by: Cursor
Signed-off-by: Wainer dos Santos Moschetta <[email protected]>

* step-registry/sandboxed-containers-operator: Add create command to create-prowjob-commands.sh

- Refactor script to support command-based interface
- Add 'create' command to generate prowjob configurations
- Move existing functionality into command_create() function
- Add proper command validation and usage help
- Maintain all existing functionality with improved structure

Assisted-by: Cursor
Signed-off-by: Wainer dos Santos Moschetta <[email protected]>

* step-registry/sandboxed-containers-operator: Add run command to create-prowjob-commands.sh

- Add 'run' command as placeholder for future prowjob execution
- Update usage help to include run command
- Add command_run() function with unimplemented message
- Maintain backward compatibility with create command

Assisted-by: Cursor
Signed-off-by: Wainer dos Santos Moschetta <[email protected]>

* step-registry/sandboxed-containers-operator: Remove "documentation" from generated prowjob

The documentation section in the generated prowjob is not valid for the
ci-operator, resulting on job run via API to fail.

Signed-off-by: Wainer dos Santos Moschetta <[email protected]>

---------

Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
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. lgtm Indicates that a PR is ready to be merged. rehearsals-ack Signifies that rehearsal jobs have been acknowledged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants