Skip to content

INTEROP-9337: Fix OCP 5.0 upgrade config and harden upgrade script - #82373

Closed
amp-rh wants to merge 3 commits into
openshift:mainfrom
amp-rh:remove-rhacs-ocp5-upgrade
Closed

INTEROP-9337: Fix OCP 5.0 upgrade config and harden upgrade script#82373
amp-rh wants to merge 3 commits into
openshift:mainfrom
amp-rh:remove-rhacs-ocp5-upgrade

Conversation

@amp-rh

@amp-rh amp-rh commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix multiple issues in the OCP 5.0 upgrade interop test configuration and harden the upgrade script. Replaces #82182 with expanded scope.

Changes

1. Remove deprecated operators from 5.0 upgrade config

  • Remove rhacs-operator (absent from v5.0 catalog)
  • Remove odf-operator (absent from v5.0 catalog)
  • Keep quay-operator, fix channel from stable-3.18 to stable-3.17 (present in v5.0 catalog; stable-3.18 does not exist)

2. Add missing backup and preflight steps

The 5.0 upgrade config had only 4 test steps while the 4.22 config has 6. Added interop-opp-backup and interop-opp-preflight before the upgrade step.

3. Add proxy-conf.sh sourcing

Source ${SHARED_DIR}/proxy-conf.sh when present, matching the pattern used by other interop step scripts.

4. Fix CSV matching from substring to prefix

Change index($2, op) > 0 to index($2, op) == 1 in ValidateOppOperators() to avoid false CSV matches.

Verification

  • Operator catalog presence verified using Red Hat operator catalog index (synced Jun-Jul 2026)
  • rhacs-operator: absent from v5.0 catalog
  • odf-operator: absent from v5.0 catalog
  • quay-operator: present with channels up to stable-3.17

References

Summary by CodeRabbit

  • Updates the OCP 5.0 policy-collection interop workflow by removing rhacs-operator and odf-operator, switching quay-operator to stable-3.17, and adding backup and preflight steps.
  • Hardens the upgrade script by sourcing optional proxy settings, replacing unavailable jq usage with oc templates and awk, and preserving health, release, admin-gate, and CSV validation checks.

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

openshift-ci-robot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@amp-rh: This pull request references INTEROP-9337 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 task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

Fix multiple issues in the OCP 5.0 upgrade interop test configuration and harden the upgrade script. Replaces #82182 with expanded scope.

Changes

1. Remove deprecated operators from 5.0 upgrade config

  • Remove rhacs-operator (absent from v5.0 catalog)
  • Remove odf-operator (absent from v5.0 catalog)
  • Keep quay-operator, fix channel from stable-3.18 to stable-3.17 (present in v5.0 catalog; stable-3.18 does not exist)

2. Add missing backup and preflight steps

The 5.0 upgrade config had only 4 test steps while the 4.22 config has 6. Added interop-opp-backup and interop-opp-preflight before the upgrade step.

3. Add proxy-conf.sh sourcing

Source ${SHARED_DIR}/proxy-conf.sh when present, matching the pattern used by other interop step scripts.

4. Fix CSV matching from substring to prefix

Change index($2, op) > 0 to index($2, op) == 1 in ValidateOppOperators() to avoid false CSV matches.

Verification

  • Operator catalog presence verified using Red Hat operator catalog index (synced Jun-Jul 2026)
  • rhacs-operator: absent from v5.0 catalog
  • odf-operator: absent from v5.0 catalog
  • quay-operator: present with channels up to stable-3.17

References

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

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@amp-rh, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 535610bc-988d-4e8b-a836-d10e7e16f1b2

📥 Commits

Reviewing files that changed from the base of the PR and between 5c7d2ee and 1a5ea35.

📒 Files selected for processing (2)
  • ci-operator/config/stolostron/policy-collection/stolostron-policy-collection-main__ocp5.0-upgrade.yaml
  • ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh

Walkthrough

The OCP 5.0 upgrade policy adds backup and preflight steps, changes operator configuration, sources optional proxy settings, and replaces several jq-based queries in the OPP upgrade script with go-template and awk parsing.

Changes

OPP upgrade workflow

Layer / File(s) Summary
Upgrade policy flow
ci-operator/config/stolostron/policy-collection/stolostron-policy-collection-main__ocp5.0-upgrade.yaml
The Quay operator channel changes to stable-3.17, RHACS and ODF are removed, and backup and preflight steps are added before upgrade.
Upgrade runtime parsing
ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh
Optional proxy configuration is sourced, and digest, admin-gate, and target-version extraction no longer uses jq.
Cluster and operator validation
ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh
Diagnostics and platform or OPP operator validation use go-template and awk pipelines while preserving existing failure checks.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • openshift/release#82182: Updates the same OCP 5.0 upgrade policy and replaces similar jq parsing in the OPP upgrade script.
  • openshift/release#82372: Changes the related OCP 4.22 upgrade policy’s Quay operator channel to stable-3.17.

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
No-Sensitive-Data-In-Logs ❌ Error The new source "${SHARED_DIR}/proxy-conf.sh" runs under set -x, and that file exports proxy_auth@host URLs, which can leak credentials/internal hostnames. Disable xtrace before sourcing proxy-conf.sh (or source it after set +x) so the exported proxy values are not echoed into logs.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (13 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: OCP 5.0 upgrade config fixes and upgrade script hardening.
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 No Ginkgo-style test titles were added or modified; the diff only touches YAML config and a shell script.
Test Structure And Quality ✅ Passed This PR only changes a ci-operator YAML and a shell script; no Ginkgo test code is modified, so the test-structure check is not applicable.
Microshift Test Compatibility ✅ Passed The PR changes only CI config and a shell script; no new Ginkgo test definitions or MicroShift-unsupported APIs/features were added.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the PR only changes CI config and a shell upgrade script, so the SNO test check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed No deployment manifests, operator code, or controllers were changed; the PR only edits CI config and a shell script, with no scheduling constraints introduced.
Ote Binary Stdout Contract ✅ Passed PR only changes ci-operator YAML and a shell step script; no OTE Go main/init/TestMain/suite stdout writes were introduced.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests or IPv4-specific logic were added; the only public curl is pre-existing in the upgrade script, not introduced by this PR.
No-Weak-Crypto ✅ Passed Changed files contain no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB or custom crypto; only SHA-256/signature checks and non-secret string comparisons.
Container-Privileges ✅ Passed Changed files contain only CI config and shell logic; no privileged, hostPID/hostNetwork/hostIPC, SYS_ADMIN, root, or allowPrivilegeEscalation settings found.
✨ 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.

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: amp-rh
Once this PR has been reviewed and has the lgtm label, please assign jan-law 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

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@ci-operator/config/stolostron/policy-collection/stolostron-policy-collection-main__ocp5.0-upgrade.yaml`:
- Line 60: Update the `interop-opp-backup`, `interop-opp-preflight`, and
`interop-opp-upgrade` steps to pass an explicit `OPP_OPERATORS` value matching
the policy’s current operator list, excluding `rhacs-operator` and
`odf-operator`; alternatively, restore those operators to the list so all
workflow checks use the same scope.

In
`@ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh`:
- Line 373: Update the awk predicate in the oppNamespaces derivation to require
each CSV name field ($2) to start with the operator name, matching the prefix
check used at line 350, rather than matching the operator name anywhere in the
field. Keep the existing namespace collection and output behavior unchanged.
🪄 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: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: fb503146-12f3-4ac8-9cd1-618be28be59e

📥 Commits

Reviewing files that changed from the base of the PR and between 1b1b4a8 and 5c7d2ee.

📒 Files selected for processing (2)
  • ci-operator/config/stolostron/policy-collection/stolostron-policy-collection-main__ocp5.0-upgrade.yaml
  • ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh

Comment thread ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh Outdated
@amp-rh

amp-rh commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

/pj-rehearse periodic-ci-stolostron-policy-collection-main-ocp4.22-upgrade-interop-opp-upgrade-aws

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

@amp-rh: now processing your pj-rehearse request. Please allow up to 10 minutes for jobs to trigger or cancel.

@amp-rh
amp-rh force-pushed the remove-rhacs-ocp5-upgrade branch from 1a5ea35 to c64002a Compare July 23, 2026 19:22
@redhat-chai-bot

redhat-chai-bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

PR Review: INTEROP-9337 — OCP 5.0 Upgrade Config & Script Hardening

Overall: Approach is sound, but has one critical gap that will cause runtime failures.

The goals are well-motivated — removing unavailable operators from the 5.0 config, fixing the Quay channel, aligning steps with 4.22, and eliminating the jq dependency. CI is clean. However, a few issues should be addressed before merge.


🚨 Critical: OPP_OPERATORS default mismatch — will cause test failures

The 5.0 YAML config now only installs 2 operators (ACM, Quay), but all three OPP steps (interop-opp-backup, interop-opp-preflight, interop-opp-upgrade) default OPP_OPERATORS to all 4 operators including rhacs-operator and odf-operator.

At runtime:

  • interop-opp-preflight will check compatibility for RHACS/ODF and likely exit with code 3
  • interop-opp-upgrade's ValidateOppOperators() will fail when it can't find CSVs for those operators
  • interop-opp-backup will try to capture state for non-existent operators

The 4.22 config doesn't have this problem because it installs all 4 operators, matching the defaults.

Fix: Add an OPP_OPERATORS env override in the 5.0 YAML config at the steps.env level:

env:
  OPP_OPERATORS: "advanced-cluster-management,quay-operator"

This scopes the override to this config without changing the shared step defaults that the 4.22 config relies on.


⚠️ Major: Prefix matching inconsistency in namespace derivation (line 373)

ValidateOppOperators() at line 350 correctly uses index($2, op) == 1 (prefix match) to find CSVs. But the namespace derivation at line 373 still uses index($2, arr[i]) > 0 (substring match anywhere). An unrelated CSV whose name happens to contain an operator name substring could incorrectly add its namespace to the readiness checks, causing a false failure.

Fix: Change > 0 to == 1 in the namespace awk command:

oppNamespaces="$(echo "${allCsvsJson}" | awk -F'\t' -v ops="${OPP_OPERATORS}" \
  'BEGIN{n=split(ops,arr,",")} {for(i=1;i<=n;i++) if(index($2,arr[i])==1){ns[$1]=1;break}} END{for(k in ns) print k}')"

ℹ️ Minor: Proxy credential leak under set -x

The script runs with set -x for debug tracing. Sourcing proxy-conf.sh will echo the exported proxy URLs (which may contain proxy_auth@host credentials) into CI build logs.

Fix: Suppress tracing around the source:

if [[ -f "${SHARED_DIR}/proxy-conf.sh" ]]; then
    set +x
    source "${SHARED_DIR}/proxy-conf.sh"
    set -x
fi

ℹ️ Minor: Fragile awk-based JSON parsing

Several jq replacements use positional field parsing (e.g. awk -F'"' '/\"digest\"/{print $4; exit}'). While oc output is generally predictable, these are more fragile than jq and could break if output formatting changes. For this PR's scope (removing the jq dependency) it's a reasonable tradeoff — the go-template replacements for oc get are solid. Worth noting for future maintainers.


Summary

Priority Issue Fix
Critical OPP_OPERATORS mismatch Add env override in 5.0 YAML
Major Prefix match inconsistency Change > 0 to == 1 on line 373
Minor Proxy credential leak Wrap source with set +x / set -x
Minor Fragile awk JSON parsing Acceptable for now, note for future

I'd recommend addressing at least the critical and major items before merge. The rest of the approach looks solid. 👍


Review by Chai Bot ([SHIP Public])

@amp-rh
amp-rh force-pushed the remove-rhacs-ocp5-upgrade branch from c64002a to a70b502 Compare July 23, 2026 19:30
@redhat-chai-bot

Copy link
Copy Markdown
Contributor

Follow-up Review: All Flagged Items Addressed ✅

Re-checked the current diff against the four items from my earlier review. All have been addressed.


🚨 Critical: OPP_OPERATORS mismatch → ✅ Fixed

An explicit OPP_OPERATORS override was added in the 5.0 YAML config:

OPP_OPERATORS: advanced-cluster-management,quay-operator

This correctly scopes the OPP steps to only the operators actually installed by this config, without affecting the 4.22 config's defaults.

⚠️ Major: Prefix matching inconsistency → ✅ Fixed

The namespace derivation awk command now uses index($2,arr[i])==1 (prefix match), consistent with ValidateOppOperators() at line 350:

for ns in $(awk -F'\t' -v ops="${OPP_OPERATORS}" \
  'BEGIN{n=split(ops,arr,",")} {for(i=1;i<=n;i++) if(index($2,arr[i])==1){ns[$1]=1;break}} END{for(k in ns) print k}' <<< "${allCsvsJson}"); do

ℹ️ Minor: Proxy credential leak → ✅ Fixed

The proxy-conf.sh sourcing is now wrapped with set +x / set -x:

if [[ -f "${SHARED_DIR}/proxy-conf.sh" ]]; then
    set +x
    source "${SHARED_DIR}/proxy-conf.sh"
    set -x
fi

ℹ️ Minor: Fragile awk JSON parsing → Acknowledged (no change needed)

As noted previously, this is an acceptable tradeoff for eliminating the jq dependency. The go-template replacements are solid.


Verdict: All critical and major items are resolved. LGTM from a code correctness standpoint. 👍


Follow-up review by Chai Bot ([SHIP Public])

@amp-rh
amp-rh force-pushed the remove-rhacs-ocp5-upgrade branch from a70b502 to 3667882 Compare July 23, 2026 19:43
@amp-rh

amp-rh commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

/pj-rehearse periodic-ci-stolostron-policy-collection-main-ocp5.0-upgrade-interop-opp-upgrade-aws

1 similar comment
@amp-rh

amp-rh commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

/pj-rehearse periodic-ci-stolostron-policy-collection-main-ocp5.0-upgrade-interop-opp-upgrade-aws

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

@amp-rh: now processing your pj-rehearse request. Please allow up to 10 minutes for jobs to trigger or cancel.

1 similar comment
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

@amp-rh: now processing your pj-rehearse request. Please allow up to 10 minutes for jobs to trigger or cancel.

@amp-rh

amp-rh commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

/pj-rehearse periodic-ci-stolostron-policy-collection-main-ocp4.22-upgrade-interop-opp-upgrade-aws

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

@amp-rh: now processing your pj-rehearse request. Please allow up to 10 minutes for jobs to trigger or cancel.

@amp-rh

amp-rh commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

/pj-rehearse periodic-ci-stolostron-policy-collection-main-ocp4.22-upgrade-interop-opp-upgrade-aws

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

@amp-rh: now processing your pj-rehearse request. Please allow up to 10 minutes for jobs to trigger or cancel.

@openshift-ci

openshift-ci Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@amp-rh: The following tests 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/rehearse/periodic-ci-stolostron-policy-collection-main-ocp4.22-upgrade-interop-opp-upgrade-aws 3667882 link unknown /pj-rehearse periodic-ci-stolostron-policy-collection-main-ocp4.22-upgrade-interop-opp-upgrade-aws
ci/rehearse/periodic-ci-stolostron-policy-collection-main-ocp5.0-upgrade-interop-opp-upgrade-aws 3667882 link unknown /pj-rehearse periodic-ci-stolostron-policy-collection-main-ocp5.0-upgrade-interop-opp-upgrade-aws

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.

@amp-rh

amp-rh commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@amp-rh

amp-rh commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

/auto-cc

@openshift-ci
openshift-ci Bot requested review from JustinKuli and shakyav July 28, 2026 13:25
@redhat-chai-bot

redhat-chai-bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review: INTEROP-9337 — OCP 5.0 upgrade config & script hardening

Thanks for this PR. I've reviewed both files — the YAML config and the upgrade shell script. Overall the changes are well-motivated and clearly documented. A few observations below.


✅ What looks good

  1. Operator catalog alignment — Removing rhacs-operator and odf-operator (absent from v5.0 catalog) and fixing quay-operator to stable-3.17 (since stable-3.18 doesn't exist) are correct. Good that the catalog presence was explicitly verified.

  2. Step parity with 4.22 — Adding interop-opp-backup and interop-opp-preflight before interop-opp-upgrade closes the gap with the 4.22 config, which already has 6 test steps.

  3. OPP_OPERATORS env var — Explicitly setting OPP_OPERATORS: advanced-cluster-management,quay-operator keeps the workflow steps in sync with the reduced operator list. This addresses the data-integrity concern CodeRabbit originally raised.

  4. Proxy sourcing — The set +x / source / set -x pattern correctly suppresses xtrace during proxy-conf sourcing, matching the convention used by other interop step scripts. (Note: CodeRabbit's pre-merge "No-Sensitive-Data-In-Logs" failure appears to be a false positive here — the sourcing does happen under set +x.)

  5. Prefix CSV matching — Changing index($2, op) > 0index($2, op) == 1 for both the phase-check loop and the namespace-derivation loop eliminates false CSV matches from substring collisions. Good catch and consistent application.


🔍 Observations and suggestions

1. jqgo-template / awk migration (shell script)

Eliminating the jq dependency is a defensible choice if the CI image doesn't ship it reliably. However, the awk-based JSON field extraction (e.g. awk -F'"' '/\"version\"/{print $4; exit}' and the similar digest extraction) is inherently more fragile than jq queries:

  • If oc ever changes the key ordering or introduces whitespace variations in its JSON output, the awk field index ($4) may silently return the wrong value.
  • Consider adding a guard or sanity check — for example, validating that targetVersion looks like a semver string after extraction, or that digest matches sha256:....

The go-template replacements for node/CO/MCP inspection are good — those are first-class oc output formats and more robust than piping JSON through jq.

2. Trap handler subshell wrapping

The trap was changed from:

trap 'exitCode=$?; DebugOnExit' EXIT TERM

to:

trap '{( exitCode=$?; DebugOnExit )}' EXIT TERM

I assume the subshell is intentional to isolate the debug handler so a stray exit inside DebugOnExit doesn't interfere with cleanup sequencing. This should work — $? is inherited into the subshell — but worth a quick manual verification. The outer {...} brace group appears redundant around the (...) subshell; trap '( exitCode=$?; DebugOnExit )' EXIT TERM would be equivalent and slightly clearer.

3. Trailing true in functions

Several functions (ResolveTargetImage, InitiateUpgrade, StabilizeCluster, ValidatePlatformHealth, DebugOnExit) now end with a bare true. This ensures a zero exit status, which is fine for functions whose last statement is an assignment or echo. For StabilizeCluster, though, the explicit exit 1 on wait-for-stable-cluster failure already handles the error path, so the trailing true is purely defensive. Not a problem, just noting it.

4. StabilizeCluster failure handling — Nice improvement: the original silently ran oc adm wait-for-stable-cluster with no failure handling. The new version gathers CO, node, and MCP diagnostics before exiting on failure. 👍

5. CI rehearsal failures

Both rehearsal jobs are currently failing:

  • periodic-ci-stolostron-policy-collection-main-ocp4.22-upgrade-interop-opp-upgrade-aws
  • periodic-ci-stolostron-policy-collection-main-ocp5.0-upgrade-interop-opp-upgrade-aws

Worth investigating whether these failures are related to the script changes (e.g. a go-template rendering difference) or are pre-existing / infrastructure issues. If the failures are pre-existing on main, a /retest or a link to a passing baseline would help reviewers confirm confidence.


Summary

The config changes are clean and well-justified. The script hardening is solid overall — the go-template conversions and prefix-match fix are clear improvements. The main area to watch is the awk-based JSON parsing, which trades a jq dependency for some fragility. Investigating the rehearsal failures will round this out.

Comment posted via Chai Bot at the request of a reviewer.

Remove rhacs-operator and odf-operator from the 5.0 upgrade config
(absent from v5.0 catalog). Fix quay-operator channel from stable-3.18
to stable-3.17. Add interop-opp-backup and interop-opp-preflight steps.
Pass explicit OPP_OPERATORS so backup, preflight, and upgrade steps
only validate installed operators.

Harden the upgrade script: source proxy-conf.sh, replace jq with oc
templates and awk, use function PascalCase declarations with typeset,
wrap oc wait in if-! guard with diagnostics, use trap subshell form,
replace pipeline || true with variable capture, use here-strings
instead of echo pipes, and add terminal true to all functions.
@amp-rh
amp-rh force-pushed the remove-rhacs-ocp5-upgrade branch from 3667882 to a620c70 Compare July 28, 2026 16:08
@amp-rh

amp-rh commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Chai Bot Review

Note: Two earlier reviews were already posted on this PR by the bot (initial review + follow-up). The three issues flagged (OPP_OPERATORS mismatch, prefix-match inconsistency, proxy credential leak) were all addressed in commit 1a5ea35. The review below reflects the current state of the PR.

CI Status: 15/16 checks pass ✅ (only tide is pending, waiting for labels/approval). All substantive checks (ci-operator-config, ci-operator-registry, step-registry-shellcheck, yamllint, core-valid, generated-config) are green.

Approval Status: Still needs approval from jan-law (OWNERS for ci-operator/config/stolostron/policy-collection/). The step-registry OWNERS are satisfied by the author.

1. YAML Config Changes (safe, well-motivated)

  • Operator removals: rhacs-operator and odf-operator removed — correctly absent from the v5.0 catalog. Verified by the author against the Red Hat operator catalog index.
  • Channel fix: quay-operator channel changed from stable-3.18 (doesn't exist) to stable-3.17 (present in v5.0 catalog). Correct fix.
  • Missing steps: Added interop-opp-backup and interop-opp-preflight before upgrade, aligning with the 4.22 config pattern (which has 6 test steps vs the 5.0 config's original 4).
  • OPP_OPERATORS override: Explicitly set to advanced-cluster-management,quay-operator, scoping the OPP steps to only the operators actually installed. This was the critical issue flagged in the earlier review — now correctly addressed.

Verdict: Config changes are safe and follow conventions. No risk to other periodic jobs — changes are scoped to the stolostron-policy-collection-main__ocp5.0-upgrade config only.

2. Shell Script Changes (sound approach, low-medium risk)

The bulk of the change replaces jq with go-template and awk alternatives throughout interop-opp-upgrade-commands.sh. This is a shared step-registry script, so changes affect all configs that use it (both 4.22 and 5.0 upgrade jobs).

Good:

  • go-template replacements for oc get queries (nodes, COs, MCPs, CSVs) are functionally equivalent and robust — Go templates are first-class in oc and don't depend on external tooling
  • Proxy-conf sourcing wrapped with set +x/set -x to prevent credential leaks
  • StabilizeCluster() now gathers diagnostics on failure before exiting — useful for debugging
  • for ... in $() replacing pipe-to-while-read avoids subshell variable scoping issues
  • Prefix matching (index == 1) is now consistent between CSV phase lookup and namespace derivation
  • Defensive true at the end of functions prevents set -e surprises

Worth noting (low risk, acceptable):

  • awk -F'"' '/"digest"/{print $4; exit}' and similar positional JSON extraction is more fragile than jq. It works reliably with oc's formatted JSON output but would break with minified JSON. Acceptable tradeoff for eliminating the jq dependency, but future maintainers should be aware.
  • The trap syntax changed to '{( exitCode=$?; DebugOnExit )}' (group+subshell). This works correctly since both exitCode assignment and DebugOnExit run in the same subshell, but it's unusual — a comment explaining the intent would help future readers.

3. Production Risk Assessment

  • Scope: The YAML changes only affect the stolostron-policy-collection-main__ocp5.0-upgrade periodic job. No impact on other interop or platform verification jobs.
  • Shared script: The shell script is in the step registry (interop/opp/upgrade) and is used by both the 4.22 and 5.0 upgrade configs. All changes are functionally equivalent (go-template/awk produce the same output as jq for well-formatted oc output), so the 4.22 job should not regress.
  • Rehearsals: The author triggered rehearsals for both ocp4.22-upgrade and ocp5.0-upgrade variants.
  • Risk level: Low. The refactoring preserves existing behavior. The config fixes are necessary — without them, the 5.0 job was broken (trying to install operators absent from the v5.0 catalog).

Overall: The PR is in good shape. All previously flagged issues are resolved. Approach is sound — the config fixes are necessary and the jq→go-template migration is a reasonable hardening step. Ready for OWNERS approval from jan-law.


Review requested by PR author via Chai Bot ([SHIP Public])

@sg-rh sg-rh left a comment

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.

Some minor comments below

Comment thread ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh Outdated
Comment thread ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh Outdated
amp-rh added 2 commits July 31, 2026 13:29
Replace awk-based JSON field extraction with oc's native -o jsonpath
for version and digest lookups, eliminating fragile positional parsing
that depends on key ordering.

Fix trap handler to run in current shell (brace group) instead of a
subshell, so exitCode propagates correctly to DebugOnExit.
… drop unnecessary exports

- Replace `|| true` on eval'd pipeline with explicit error handling
  to avoid masking oc failures under pipefail
- Add `true` as final statement in functions with early returns
- Replace `export` with `typeset -g` for script-local variables
@amp-rh

amp-rh commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

Applied additional best-practices fixes from a shell scripting audit:

Major:

  • Replaced || true on an eval'd pipeline in MonitorUpgrade with explicit error handling. Under pipefail, || true masks failures in all pipeline stages (e.g., oc adm upgrade failing silently during polling). Now captures the failure and sets currentStatus="" so the existing empty-check handles it.

Minor (convention):

  • Added true as the final statement in CheckSigned, AdminAck, UpdateCcoAnnotation, and MonitorUpgrade functions (defensive coding under set -e)
  • Replaced export with typeset -g for targetVersion, targetMinorVersion, sourceVersion, sourceMinorVersion since they're only used within this script and don't need to be environment variables

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

[REHEARSALNOTIFIER]
@amp-rh: the pj-rehearse plugin accommodates running rehearsal tests for the changes in this PR. Expand 'Interacting with pj-rehearse' for usage details. The following rehearsable tests have been affected by this change:

Test name Repo Type Reason
periodic-ci-stolostron-policy-collection-main-ocp4.22-upgrade-interop-opp-upgrade-aws N/A periodic Registry content changed
periodic-ci-stolostron-policy-collection-main-ocp5.0-upgrade-interop-opp-upgrade-aws N/A periodic Ci-operator config changed
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.

@amp-rh

amp-rh commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Closing: primary changes (operator removal, quay channel fix, test steps) already landed in #82372. Remaining changes (proxy-conf.sh sourcing, CSV prefix-match fix) will be submitted in a separate focused PR. rhacs-operator has since reappeared in the OCP 5.0 catalog and will be re-added in a separate PR.

@amp-rh amp-rh closed this Aug 4, 2026
amp-rh added a commit to amp-rh/openshift-release that referenced this pull request Aug 12, 2026
…handling

Replace all jq-based queries with go-template, jsonpath, and awk
equivalents so the upgrade script no longer requires jq (unavailable
in the cli base image). Additional improvements:

- Add set +x/set -x guards around proxy-conf.sh sourcing
- Fix trap handler to use brace group for exitCode propagation
- Replace while-read pipes with for-in loops (avoid subshell scoping)
- Use typeset -g instead of export for version variables
- Add failure diagnostics to StabilizeCluster
- Add defensive true at function ends
- Use function keyword with PascalCase declarations
- Set OPP_OPERATORS explicitly in the 5.0 config (excludes odf-operator)

Addresses review feedback from sg-rh on openshift#82373 (jsonpath over awk,
trap handler fix) and CodeRabbit findings (OPP_OPERATORS scope, CSV
prefix matching).
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