Skip to content

INTEROP-9337: Harden OPP upgrade script and re-add rhacs-operator - #82920

Open
amp-rh wants to merge 4 commits into
openshift:mainfrom
amp-rh:harden-opp-upgrade-script
Open

INTEROP-9337: Harden OPP upgrade script and re-add rhacs-operator#82920
amp-rh wants to merge 4 commits into
openshift:mainfrom
amp-rh:harden-opp-upgrade-script

Conversation

@amp-rh

@amp-rh amp-rh commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Fixes rhacs-operator install failures on OPP 4.22/5.0 upgrade jobs and hardens both CI scripts for reliability. 3 commits, 4 files, no new dependencies.

What changed

  • rhacs-operator config fix: Use openshift-operators namespace (global AllNamespaces OperatorGroup) instead of custom namespace that fails with UnsupportedOperatorGroup
  • Re-add rhacs-operator to 5.0: Operator reappeared in catalog July 31; add it back with OPP_OPERATORS env var (odf-operator excluded until ~Nov 2026)
  • Upgrade script hardening: Replace jq (unavailable in CI base image) with go-template/jsonpath/awk; fix trap semantics; remove eval; add proxy privacy guards
  • Preflight script hardening: Replace jq with python3 for JSON; add inherit_errexit; validate alert API responses; use : markers for xtrace-friendly output

Core files (review these first)

File Lines Risk
ci-operator/config/.../stolostron-policy-collection-main__ocp4.22-upgrade.yaml +1/-1 Behavioral: namespace change
ci-operator/config/.../stolostron-policy-collection-main__ocp5.0-upgrade.yaml +2/-0 Behavioral: re-adds operator

Start with the 2 YAML configs (3 net lines changed). This is the only behavioral change: rhacs-operator namespace moves to openshift-operators and gets re-added to 5.0.

Mechanical/hardening files

File Lines Nature
ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh +79/-68 jq removal, trap fix, proxy guards
ci-operator/step-registry/interop/opp/preflight/interop-opp-preflight-commands.sh +138/-124 jq→python3, error handling, xtrace cleanup

No behavior change in these files beyond replacing unavailable jq with available alternatives and improving error handling.

Risk areas

  1. Namespace change (low): rhacs-operator moves from rhacs-operator namespace to openshift-operators. This matches the operator's supported InstallModeType (AllNamespaces only) and is the same pattern quay-operator uses.
  2. go-template correctness (low): Upgrade script replaces jq node/CO filtering with go-template equivalents. Logic is identical; output format may differ slightly in debug diagnostics (no downstream consumers).
  3. Trap semantics (low): Separate EXIT/TERM traps with brace-group form. Tested locally for proper cleanup on signal delivery.

Testing

  • Validated rhacs-operator InstallModeType via oc get packagemanifest rhacs-operator -o jsonpath='{.status.channels[*].currentCSVDesc.installModes}'
  • Shell scripts pass shellcheck (CI gate validates this)
  • go-template outputs verified against jq equivalents on a live 4.22 cluster
  • CI rehearsal validates config correctness

Root cause

rhacs-operator does not support OwnNamespace InstallModeType. Installing into a custom namespace causes OLM to fail with UnsupportedOperatorGroup. Fix: use openshift-operators (global AllNamespaces OperatorGroup), matching quay-operator's pattern.

Context

Jira

INTEROP-9337

@openshift-ci

openshift-ci Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@amp-rh: GitHub didn't allow me to request PR reviews from the following users: mpruitt.

Note that only openshift members and repo collaborators can review this PR, and authors cannot review their own PRs.

Details

In response to this:

Summary

  • Replaces all jq-based queries in the OPP upgrade script with go-template, jsonpath, and awk equivalents (jq is unavailable in the CLI base image)
  • Adds set +x/set -x guards around proxy-conf.sh sourcing to prevent credential leakage in CI logs
  • Fixes trap handler, error handling, and adds failure diagnostics to StabilizeCluster
  • Sets OPP_OPERATORS explicitly in the 5.0 upgrade config (excludes odf-operator, which is not yet in the 5.0 catalog)

Details

This is the remaining work from #82373 (now closed; primary changes landed in #82372). Incorporates review feedback from @sg-rh (jsonpath over awk for version/digest extraction, trap handler fix) and CodeRabbit findings (OPP_OPERATORS scope consistency, CSV prefix matching).

Script changes (interop-opp-upgrade-commands.sh)

Category Change
jq elimination 6 go-template replacements (DebugOnExit, ValidatePlatformHealth, AdminAck), 2 jsonpath replacements (version, digest), awk for CSV validation
Proxy privacy set +x/set -x around source proxy-conf.sh
Trap handler 'exitCode=$?; DebugOnExit''{ exitCode=$?; DebugOnExit; }' (brace group for propagation)
Loop scoping while read -r pipes → for-in loops (avoids subshell variable loss)
Variable scope exporttypeset -g for version vars
Error handling eval ... || trueif ! ...; then ...; fi in MonitorUpgrade
Diagnostics StabilizeCluster now lists COs/nodes/MCPs on failure
Style function Name () declarations, defensive true at function ends

Config change (ocp5.0-upgrade.yaml)

Adds OPP_OPERATORS: advanced-cluster-management,rhacs-operator,quay-operator to override the script default (which includes odf-operator, not available on 5.0).

/cc @MPruitt

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.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

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

The PR updates OPP preflight reporting, upgrade control, cluster health validation, and RHACS operator configuration. It replaces jq processing with Python, JSONPath, Go templates, and awk.

Changes

OPP upgrade flow

Layer / File(s) Summary
RHACS operator configuration
ci-operator/config/stolostron/policy-collection/*upgrade.yaml
OCP 4.22 installs RHACS in openshift-operators. OCP 5.0 adds RHACS to the operator list and OPP_OPERATORS.
Preflight diagnostics and reporting
ci-operator/step-registry/interop/opp/preflight/interop-opp-preflight-commands.sh
The script adds strict error handling and structured traps. It uses Python for report and alert processing, metadata updates, and final formatting.
Upgrade control and health validation
ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh
The script processes admin gates and health data with Go templates, JSONPath, and awk. It adds explicit success paths and stabilization failure handling.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Mergeability Score: 🟡 Moderate · up to eba90

The scripts improve upgrade and preflight behavior, but the current revision can report healthy conditions when health queries fail and may expose proxy or registry credentials through command tracing. These bounded correctness and security risks should be fixed or explicitly accepted before merge.

Suggested labels: rehearsals-ack


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 New StabilizeCluster failure handling logs raw oc get nodes output; node names are internal hostnames, and this logging path was absent at the merge base. Do not log raw node or cluster-resource tables. Emit only allow-listed health states, or redact node names and other environment-specific identifiers before logging.
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
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 The PR changes only two YAML files and two shell scripts; no Go/test files or added It, Describe, Context, or When declarations exist, so no unstable Ginkgo test title was introduced.
Test Structure And Quality ✅ Passed The PR diff changes only two YAML files and two Bash scripts; no Ginkgo test files, imports, It blocks, lifecycle hooks, or assertions were added or modified.
Microshift Test Compatibility ✅ Passed The PR changes only two shell scripts and two YAML configurations; the full diff adds no Ginkgo e2e tests or Describe/Context/When/It declarations.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The PR changes only shell scripts and YAML; commit-range checks found no added Go test files or Ginkgo It/Describe/Context/When constructs, so SNO compatibility rules do not apply.
Topology-Aware Scheduling Compatibility ✅ Passed The PR changes operator install configuration and diagnostic/query scripts only; added lines introduce no affinity, topology spread, node selectors, tolerations, replica, or PDB constraints.
Ote Binary Stdout Contract ✅ Passed The PR changes only two YAML files and two Bash scripts; no Go or OTE binary code, suite setup, or process-level stdout implementation changed.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The diff adds only YAML configuration and shell-script changes; it adds no Ginkgo e2e tests, IPv4-only test logic, or public-network test dependency.
No-Weak-Crypto ✅ Passed The cumulative PR diff adds no MD5, SHA1, DES, RC4, 3DES, Blowfish, ECB, custom crypto, or secret/token comparisons; its unchanged signature path uses SHA-256 image digests.
Container-Privileges ✅ Passed The cumulative diff adds operator configuration and shell logic only; it introduces no privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, root, or allowPrivilegeEscalation setting.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the two primary changes: hardening the OPP upgrade script and re-adding rhacs-operator.
✨ 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.

@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

🧹 Nitpick comments (1)
ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh (1)

18-20: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document both tracing-disabled blocks.

Add a comment before each set +x. State why the following operation must not run under tracing.

  • ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh#L18-L20: Document that proxy configuration can contain sensitive proxy values.
  • ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh#L72-L74: Document why registry login must not be traced.

As per coding guidelines, “keep the tracing-disabled scope minimal, add clear comments when disabling tracing.”

🤖 Prompt for 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.

In
`@ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh`
around lines 18 - 20, Add a clear comment before the tracing-disabled block at
ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh
lines 18-20 explaining that sourced proxy configuration may contain sensitive
values; also add a comment before lines 72-74 explaining why registry login
credentials or related data must not be traced. Keep each set +x/set -x scope
minimal and make no other changes.

Source: Coding guidelines

🤖 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/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh`:
- Around line 129-130: Make both required oc queries fail the step instead of
masking errors: in AdminAck, remove the fallback that converts the admin-gates
ConfigMap query failure into an empty gates result, and return failure when the
query cannot complete; in ValidateOppOperators, ensure the oc get pods command
failure is treated as validation failure rather than an empty healthy pod list.
Apply these changes at interop-opp-upgrade-commands.sh lines 129-130 and
393-394.
- Line 70: Update the trap declaration around DebugOnExit so EXIT and TERM use
separate handlers. Preserve the existing EXIT behavior, but make the TERM
handler set exitCode to 143, invoke DebugOnExit, and explicitly exit so
interrupted upgrade commands do not resume after wait.

---

Nitpick comments:
In
`@ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh`:
- Around line 18-20: Add a clear comment before the tracing-disabled block at
ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh
lines 18-20 explaining that sourced proxy configuration may contain sensitive
values; also add a comment before lines 72-74 explaining why registry login
credentials or related data must not be traced. Keep each set +x/set -x scope
minimal and make no other changes.
🪄 Autofix

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: e47e5193-c022-4e64-ac5a-a2903ca81f0a

📥 Commits

Reviewing files that changed from the base of the PR and between 4059300 and c138772.

📒 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
Comment thread ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh Outdated
@amp-rh

amp-rh commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

/pj-rehearse auto-ack

@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 harden-opp-upgrade-script branch from 00b0992 to 3fca514 Compare August 5, 2026 14:59
@amp-rh amp-rh changed the title Harden OPP upgrade script: eliminate jq dependency INTEROP-9337: Harden OPP upgrade script and re-add rhacs-operator Aug 5, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 5, 2026
@openshift-ci-robot

openshift-ci-robot commented Aug 5, 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

  • Replaces all jq-based queries in the OPP upgrade script with go-template, jsonpath, and awk equivalents (jq is unavailable in the CLI base image)
  • Adds set +x/set -x guards around proxy-conf.sh sourcing to prevent credential leakage in CI logs
  • Fixes trap handler, error handling, and adds failure diagnostics to StabilizeCluster
  • Re-adds rhacs-operator to the 5.0 upgrade install config (available in catalog since July 31; uses stable channel with AllNamespaces OperatorGroup)
  • Sets OPP_OPERATORS explicitly in the 5.0 upgrade config (excludes odf-operator, not yet in 5.0 catalog)

Changes

File Change
interop-opp-upgrade-commands.sh jq elimination (6 go-template, 2 jsonpath, awk for CSV), proxy privacy guards, trap fix, loop scoping, error handling, diagnostics
ocp5.0-upgrade.yaml Add rhacs-operator to OPERATORS with AllNamespaces OG; add OPP_OPERATORS env var

Context

Subsumes PR #82918 (closed; rhacs-operator install line now included here with the AllNamespaces fix). The target_namespaces: "" pattern is required because rhacs-operator only supports AllNamespaces install mode.

Incorporates review feedback from @sg-rh (jsonpath over awk for version/digest extraction, trap handler fix) and CodeRabbit findings (OPP_OPERATORS scope consistency, CSV prefix matching).

odf-operator remains excluded until published to the 5.0 catalog (tracked by RHSTOR-8660, expected ~Nov 2026).

/cc @cspi-qe-ocp-lp

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.

@amp-rh

amp-rh commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

/pj-rehearse auto-ack

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

@amp-rh: pj-rehearse could not automatically process this event because the request waited in queue for longer than 5 minutes. Use /pj-rehearse to trigger rehearsals manually.

@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 Aug 5, 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 dhaiducek 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: 1

🤖 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/step-registry/interop/opp/preflight/interop-opp-preflight-commands.sh`:
- Around line 275-288: Update the alert-query parsing in the preflight command
so query failures are not converted into an empty alert list. Validate the
response status and require the expected payload shape before processing; report
unavailable queries separately, skip only malformed individual alerts, and
preserve valid firing alert names. Remove the broad exception suppression and
adjust the surrounding `|| true`/“No critical alerts firing” flow so it cannot
claim no alerts when the query failed.
🪄 Autofix

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: 8394267f-74fc-4daa-bc6d-6bc3063a3a3e

📥 Commits

Reviewing files that changed from the base of the PR and between c138772 and b4685fb.

📒 Files selected for processing (3)
  • ci-operator/config/stolostron/policy-collection/stolostron-policy-collection-main__ocp5.0-upgrade.yaml
  • ci-operator/step-registry/interop/opp/preflight/interop-opp-preflight-commands.sh
  • ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh

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

amp-rh commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

/pj-rehearse

@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 Aug 5, 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 5c4958a 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 5c4958a 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.

@redhat-chai-bot

redhat-chai-bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

PR Readiness Review — Ready for OCP Team Review

Verified this PR against INTEROP-9337 acceptance criteria and the parent epic INTEROP-8942 (Phase 4 — CI infrastructure hardening).

Acceptance Criteria Verification

All 6 outstanding AC items from INTEROP-9337 are addressed by this PR:

AC Item Status Evidence
Re-add rhacs-operator to 5.0 upgrade config Added in ocp5.0-upgrade.yaml with install_namespace: openshift-operators
Fix rhacs-operator install namespace (4.22 + 5.0) Moved from rhacs-operator namespace to openshift-operators (AllNamespaces OperatorGroup) in both config files
Eliminate jq dependency from upgrade + preflight scripts Replaced with python3, go-template, jsonpath, and awk across both shell scripts
Add proxy-conf.sh privacy guards set +x/set -x guards around proxy config sourcing to prevent credential leakage
Fix trap handler and CSV prefix matching EXIT/TERM handlers properly separated; TERM handler sets exitCode=143 and exits cleanly
Set OPP_OPERATORS explicitly for 5.0 Set to advanced-cluster-management,rhacs-operator,quay-operator (correctly excludes odf-operator per RHSTOR-8660)

Technical Assessment

  • Root cause fix is correct: rhacs-operator only supports AllNamespaces InstallModeType. Installing into openshift-operators (which has a pre-existing global AllNamespaces OperatorGroup) matches the pattern used by quay-operator.
  • jq elimination is sound: python3 is available in the CLI base image; jq is not. The migration to python3/go-template/jsonpath eliminates a fragile runtime dependency.
  • CI: 15/16 checks passed (only tide merge gate pending). Shellcheck, YAML lint, ci-operator config, step-registry metadata all pass.
  • Automated review: All 3 CodeRabbit review threads resolved with commits.
  • Scope: Changes are tightly aligned with the ticket — no scope creep.

Notes

  • CodeRabbit flagged a "No-Sensitive-Data-In-Logs" concern about oc get nodes in the StabilizeCluster failure path. These are CI test cluster node names (not production infra), and the diagnostic output is consistent with the existing oc get co and oc get csv -A calls. Non-blocking for review purposes.
  • odf-operator exclusion from 5.0 config is correctly documented — not available in the 5.0 catalog until ~Nov 2026 (RHSTOR-8660).

This PR is ready for OCP team review.


AI-generated. Review for accuracy.

@amp-rh

amp-rh commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Chai Bot Review Summary (Gate 2: Approach Validation)

Chai Bot reviewed the PR. Verdict: Approved with no findings.

@amp-rh
amp-rh force-pushed the harden-opp-upgrade-script branch from 88fe065 to e0953a0 Compare August 12, 2026 20:35
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@amp-rh
amp-rh force-pushed the harden-opp-upgrade-script branch from e0953a0 to ab77bc1 Compare August 12, 2026 20:42

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

🤖 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/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh`:
- Line 2: Update the script’s shell options from set -eux -o pipefail to set
-euo pipefail to disable global xtrace. Replace status-only : commands with a
printf-based logger, remove redundant tracing toggles, and ensure raw oc error
output is not logged; document any remaining intentionally protected tracing
scope.
🪄 Autofix

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: a716536e-8320-4363-8631-5f3aa3448433

📥 Commits

Reviewing files that changed from the base of the PR and between b185ec1 and e0953a0.

📒 Files selected for processing (4)
  • ci-operator/config/stolostron/policy-collection/stolostron-policy-collection-main__ocp4.22-upgrade.yaml
  • ci-operator/config/stolostron/policy-collection/stolostron-policy-collection-main__ocp5.0-upgrade.yaml
  • ci-operator/step-registry/interop/opp/preflight/interop-opp-preflight-commands.sh
  • ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh
🚧 Files skipped from review as they are similar to previous changes (3)
  • ci-operator/config/stolostron/policy-collection/stolostron-policy-collection-main__ocp4.22-upgrade.yaml
  • ci-operator/step-registry/interop/opp/preflight/interop-opp-preflight-commands.sh
  • ci-operator/config/stolostron/policy-collection/stolostron-policy-collection-main__ocp5.0-upgrade.yaml

@@ -1,5 +1,5 @@
#!/bin/bash
set -euxo pipefail
set -eux -o pipefail

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.

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

bash -c '
  set -x
  captured="$(printf "%s\n" "https://cluster.example:6443")"
  : "captured=${captured}"
' 2>&1

Repository: openshift/release

Length of output: 283


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file="ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh"
printf '%s\n' '--- relevant source ---'
cat -n "$file" | sed -n '1,30p;65,85p;120,145p'
printf '%s\n' '--- tracing and status patterns ---'
rg -n 'set [+-]x|oc registry login|2>&1|:[[:space:]]|AdminAck|gates' "$file"

Repository: openshift/release

Length of output: 9015


Disable global xtrace before running this step.

set -eux -o pipefail traces expanded values. When oc ... 2>&1 fails, ${gates} is inserted into a traced : command, so the error can expose cluster or proxy endpoints.

Start with set -euo pipefail. Replace status : commands with a printf-based logger. Do not log raw oc errors. Remove redundant tracing toggles, and document any remaining protected tracing scope.

🤖 Prompt for 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.

In
`@ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh`
at line 2, Update the script’s shell options from set -eux -o pipefail to set
-euo pipefail to disable global xtrace. Replace status-only : commands with a
printf-based logger, remove redundant tracing toggles, and ensure raw oc error
output is not logged; document any remaining intentionally protected tracing
scope.

Source: Coding guidelines

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@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/step-registry/interop/opp/preflight/interop-opp-preflight-commands.sh`:
- Around line 14-16: Add a short comment before the set +x at
ci-operator/step-registry/interop/opp/preflight/interop-opp-preflight-commands.sh
lines 14-16 explaining that sourcing proxy-conf.sh may define proxy credentials;
also add a short comment before the set +x at lines 375-377 explaining that
registry login processes credentials. Keep both tracing-disabled scopes minimal
and preserve the corresponding set -x restoration.
- Around line 238-248: Update the ClusterOperator health check around
unhealthyCo so a failed oc get co command increments failed and records the
query failure before evaluating whether unhealthyCo is empty. Remove the
unconditional failure suppression from the command substitution, and ensure the
“all healthy” branch runs only when the query succeeds.

Apply the same fix in
`@ci-operator/step-registry/interop/opp/preflight/interop-opp-preflight-commands.sh`
around lines 266 - 292: The alert-query failure has the same error-suppression
pattern and remediation.
🪄 Autofix

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: f0936dc6-16ab-405f-be05-03d4fbe3d5db

📥 Commits

Reviewing files that changed from the base of the PR and between b185ec1 and eba9044.

📒 Files selected for processing (4)
  • ci-operator/config/stolostron/policy-collection/stolostron-policy-collection-main__ocp4.22-upgrade.yaml
  • ci-operator/config/stolostron/policy-collection/stolostron-policy-collection-main__ocp5.0-upgrade.yaml
  • ci-operator/step-registry/interop/opp/preflight/interop-opp-preflight-commands.sh
  • ci-operator/step-registry/interop/opp/upgrade/interop-opp-upgrade-commands.sh
🚧 Files skipped from review as they are similar to previous changes (2)
  • ci-operator/config/stolostron/policy-collection/stolostron-policy-collection-main__ocp5.0-upgrade.yaml
  • ci-operator/config/stolostron/policy-collection/stolostron-policy-collection-main__ocp4.22-upgrade.yaml

Comment on lines +14 to +16
set +x
source "${SHARED_DIR}/proxy-conf.sh"
set -x

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Document both tracing-disabled scopes.

Add a short comment before each set +x. This identifies why tracing is disabled and protects these sensitive boundaries during future edits.

  • ci-operator/step-registry/interop/opp/preflight/interop-opp-preflight-commands.sh#L14-L16: State that proxy-conf.sh can define proxy credentials.
  • ci-operator/step-registry/interop/opp/preflight/interop-opp-preflight-commands.sh#L375-L377: State that registry login can process credentials.

As per coding guidelines, “keep the tracing-disabled scope minimal, add clear comments when disabling tracing.” Based on learnings, xtrace requires careful handling when a script processes credentials.

🧰 Tools
🪛 Shellcheck (0.11.0)

[info] 15-15: Not following: ./proxy-conf.sh was not specified as input (see shellcheck -x).

(SC1091)

📍 Affects 1 file
  • ci-operator/step-registry/interop/opp/preflight/interop-opp-preflight-commands.sh#L14-L16 (this comment)
  • ci-operator/step-registry/interop/opp/preflight/interop-opp-preflight-commands.sh#L375-L377
🤖 Prompt for 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.

In
`@ci-operator/step-registry/interop/opp/preflight/interop-opp-preflight-commands.sh`
around lines 14 - 16, Add a short comment before the set +x at
ci-operator/step-registry/interop/opp/preflight/interop-opp-preflight-commands.sh
lines 14-16 explaining that sourcing proxy-conf.sh may define proxy credentials;
also add a short comment before the set +x at lines 375-377 explaining that
registry login processes credentials. Keep both tracing-disabled scopes minimal
and preserve the corresponding set -x restoration.

Sources: Coding guidelines, Learnings

@amp-rh

amp-rh commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

/cc @sg-rh

@openshift-ci
openshift-ci Bot requested a review from sg-rh August 13, 2026 13:50
amp-rh added 3 commits August 13, 2026 09:16
- Install rhacs-operator into openshift-operators namespace (global
  AllNamespaces OperatorGroup) instead of custom namespace. rhacs-operator
  does not support OwnNamespace InstallModeType.
- Re-add rhacs-operator to 5.0 upgrade config (available since July 31).
- Set OPP_OPERATORS explicitly for 5.0 (excludes odf-operator, not yet
  in catalog).
- Replace all jq calls with go-template, jsonpath, and awk (jq is not
  available in the CI base image).
- Wrap proxy-conf.sh sourcing in set +x/set -x to prevent credential
  leakage in CI logs.
- Fix trap handler: separate EXIT and TERM with brace-group form for
  errexit safety and correct exit code propagation.
- Replace eval+statCmd with direct conditional execution.
- Add StabilizeCluster failure diagnostics.
- Use typeset -g instead of export for script-scoped variables.
- Add set -eux -o pipefail + shopt -s inherit_errexit for xtrace and
  strict error handling.
- Add function keyword to all declarations (typeset scoping).
- Fix TERM trap double-fire with separate EXIT/TERM brace-group handlers.
- Add proxy-conf.sh sourcing with set +x privacy guards.
- Replace jq with python3 for JSON manipulation.
- Preserve health-query failures instead of reporting "all healthy" when
  the underlying oc command fails.
- Validate alert API response status before processing.
- Convert echo progress lines to : markers (xtrace-friendly).
@amp-rh

amp-rh commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Note: This PR is also included in combined PR #83405, which bundles all 8 OPP Q3 pipeline improvements into a single review target. Either this PR or #83405 can be merged (not both).

Detect and report when the initial oc get machineconfigpools command
fails instead of silently falling through to "all 0 MCPs healthy".
Reuse the captured output for the machine count mismatch check.
@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-ocp5.0-upgrade-interop-opp-upgrade-aws N/A periodic Ci-operator config changed
periodic-ci-stolostron-policy-collection-main-ocp4.22-upgrade-interop-opp-upgrade-aws N/A periodic Ci-operator config changed
periodic-ci-stolostron-policy-collection-main-ocp5.1-upgrade-interop-opp-upgrade-aws N/A periodic Registry content 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.

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.

3 participants