Skip to content

OU-1107 OU-1108: ACM alerting UI with alerts and perses - #1105

Draft
etmurasaki wants to merge 4 commits into
openshift:mainfrom
etmurasaki:etmura-ou1107
Draft

OU-1107 OU-1108: ACM alerting UI with alerts and perses#1105
etmurasaki wants to merge 4 commits into
openshift:mainfrom
etmurasaki:etmura-ou1107

Conversation

@etmurasaki

@etmurasaki etmurasaki commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes

    • Improved Alerting behavior across Core platform and Fleet Management perspectives, including filtering, silencing, expiration, and alert details.
    • Improved empty states, filter interactions, dashboard navigation, and loading reliability.
    • Fleet Management now hides unsupported Incidents and Signal correlation options.
  • Enhancements

    • Enabled supported Incidents and Perses monitoring components.
    • Added ACM Perses dashboard integration and expanded dashboard support across perspectives.
    • Improved monitoring plugin image verification and dashboard filter handling.

@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 28, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 28, 2026

Copy link
Copy Markdown

@etmurasaki: This pull request references OU-1107 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:

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 openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 28, 2026
@openshift-ci

openshift-ci Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 28, 2026
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: d73b406b-f4b0-4584-af69-f3b2d1644c27

📥 Commits

Reviewing files that changed from the base of the PR and between 02a9aa8 and 0146fd2.

📒 Files selected for processing (5)
  • web/cypress/e2e/coo/01.coo_ivt.cy.ts
  • web/cypress/e2e/coo/02.acm_alerting_ui.cy.ts
  • web/cypress/support/commands/image-patch-commands.ts
  • web/cypress/support/monitoring/01.reg_alerts.cy.ts
  • web/cypress/support/perses/00.coo_bvt_perses_admin.cy.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • web/cypress/e2e/coo/02.acm_alerting_ui.cy.ts
  • web/cypress/support/commands/image-patch-commands.ts
  • web/cypress/support/perses/00.coo_bvt_perses_admin.cy.ts
  • web/cypress/support/monitoring/01.reg_alerts.cy.ts

Walkthrough

Cypress coverage now supports Core platform and Fleet management perspectives for alerting and Perses dashboards. Fixtures enable Incidents and Perses. Shared helpers use perspective-specific alert data, configurable dashboard labels, updated selectors, readiness checks, and monitoring console image verification.

Changes

Monitoring perspective coverage

Layer / File(s) Summary
Alerting regression and Fleet coverage
web/cypress/support/monitoring/..., web/cypress/e2e/coo/02.acm_alerting_ui.cy.ts
Alert tests use perspective-specific alert names, namespaces, cluster filters, and silence flows. Fleet tests verify hidden Incidents and Signal correlation entries.
Monitoring fixtures and setup
web/cypress/fixtures/coo/..., web/cypress/support/commands/...
Fixtures enable Incidents and Perses. COO setup verifies the monitoring console plugin image with retries.
Alerting and navigation helpers
web/cypress/views/..., web/cypress/support/commands/...
Helpers update filter cleanup, empty-state checks, navigation scrolling, visibility assertions, and readiness waits.

Perses perspective coverage

Layer / File(s) Summary
Perses suite wiring
web/cypress/e2e/coo/02.acm_perses.cy.ts, web/cypress/e2e/perses/...
Perses suites switch to Core platform. A Fleet management BVT suite covers COO dashboards.
Configurable dashboard navigation
web/cypress/support/perses/...
Perses configurations accept optional dashboard page names and pass them to loading checks and navigation.
Perses selectors and interactions
web/cypress/views/perses-dashboards-list-dashboards.ts, web/cypress/views/perses-dashboards-edit-variables.ts, web/src/shared/constants/data-test.ts
Dashboard checks use OUIA selectors, updated filter labels, conditional favorite-star assertions, and revised input timing.

Estimated code review effort: 4 (Complex) | ~60 minutes


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 PR logs MCP_CONSOLE_IMAGE, current pod image, and complete CSV YAML; these values may contain private image registries, internal hostnames, or deployment data. Remove image values and CSV dumps from logs. Log only safe status and retry metadata, and redact registry hostnames or sensitive fields before output.
Docstring Coverage ⚠️ Warning Docstring coverage is 9.68% 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 clearly identifies the main ACM alerting UI changes for alerts and Perses.
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 Cypress/Mocha tests are used, not Ginkgo; titles are static or use literal perspective names, and Math.random() only builds a dashboard name in a test body.
Test Structure And Quality ✅ Passed Not applicable: the commit changes only four Cypress TypeScript files, with no Ginkgo APIs; the repository's Go test uses standard testing and testify.
Microshift Test Compatibility ✅ Passed The pull request adds Cypress TypeScript tests only; it adds no Ginkgo tests, Go files, Ginkgo constructs, or MicroShift-specific Ginkgo guards.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR changes only Cypress/TypeScript and fixture files; no Ginkgo Go tests were added, and searches found no multi-node assumptions such as affinity, node scaling, draining, failover, or topology req...
Topology-Aware Scheduling Compatibility ✅ Passed The PR changes Cypress tests and fixture configuration only; added UIPlugin flags and alert labels introduce no affinity, topology spread, selectors, tolerations, replica, or PDB scheduling constra...
Ote Binary Stdout Contract ✅ Passed The PR changes only Cypress, fixture, and frontend files; it adds no Go or OTE process-level code and introduces no stdout writes in main or suite setup.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR adds Cypress TypeScript suites, not Ginkgo tests; the PR range contains no changed Go files or Ginkgo markers, and no IPv4-only code was added.
No-Weak-Crypto ✅ Passed PR additions contain no MD5, SHA1, DES, RC4, 3DES, Blowfish, or ECB usage, crypto APIs, custom crypto, or secret/token comparisons.
Container-Privileges ✅ Passed Full PR diff adds no privileged, hostPID/hostNetwork/hostIPC, SYS_ADMIN, allowPrivilegeEscalation:true, or explicit root settings; changed COO manifests and scripts contain none.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
web/cypress/support/monitoring/01.reg_alerts.cy.ts (1)

43-113: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Near-duplicate "Alerting Rules page - Filtering" test between Fleet Management and Core Platform.

testAlertsFleetManagementRegression's second it block (lines 73-112) and testAlertsCorePlatformHeaderRegression's second it block (lines 142-182) are identical apart from one extra listPage.filter.removeIndividualTag(Source.PLATFORM); call (line 146). Extracting the shared filtering flow into a single helper (parameterized by the one extra teardown step) would prevent the two copies from drifting apart over time.

♻️ Suggested extraction
function testAlertingRulesFilteringRegression(
  perspective: PerspectiveConfig,
  beforeFilters?: () => void,
) {
  it(`${perspective.name} perspective - Alerting > Alerting Rules page - Filtering`, () => {
    cy.log('2.1 use sidebar nav to go to Observe > Alerting');
    nav.tabs.switchTab('Alerting rules');
    alertingRuleListPage.shouldBeLoaded();
    beforeFilters?.();

    cy.log('2.2 clear all filters, verify filters and tags');
    // ...shared body...
    alertingRuleListPage.filter.assertNoClearAllFilters();
  });
}

Then call it with () => listPage.filter.removeIndividualTag(Source.PLATFORM) from testAlertsCorePlatformHeaderRegression and with no callback from testAlertsFleetManagementRegression.

Also applies to: 142-183

🤖 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 `@web/cypress/support/monitoring/01.reg_alerts.cy.ts` around lines 43 - 113,
Extract the duplicated Alerting Rules filtering test flow from
testAlertsFleetManagementRegression and testAlertsCorePlatformHeaderRegression
into a shared testAlertingRulesFilteringRegression helper. Parameterize the
helper with an optional beforeFilters callback, invoke it before applying
filters, and pass the Source.PLATFORM removal callback only from the Core
Platform test while leaving the Fleet Management call without one.
🤖 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 `@web/cypress/e2e/coo/02.acm_alerting_ui.cy.ts`:
- Around line 58-69: Add cy.closeOnboardingModalIfPresent() after
cy.switchPerspective('Fleet management') in the “Visual validation for features
that should not be displayed under Fleet management perspective” test, before
navigating with nav.sidenav.clickNavLink(...), so the test works independently
when the onboarding modal is present.

---

Nitpick comments:
In `@web/cypress/support/monitoring/01.reg_alerts.cy.ts`:
- Around line 43-113: Extract the duplicated Alerting Rules filtering test flow
from testAlertsFleetManagementRegression and
testAlertsCorePlatformHeaderRegression into a shared
testAlertingRulesFilteringRegression helper. Parameterize the helper with an
optional beforeFilters callback, invoke it before applying filters, and pass the
Source.PLATFORM removal callback only from the Core Platform test while leaving
the Fleet Management call without one.
🪄 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: Enterprise

Run ID: 4b8b056f-70a6-4cd9-8420-8be26cad4f42

📥 Commits

Reviewing files that changed from the base of the PR and between b73be6f and 49ec998.

📒 Files selected for processing (12)
  • web/cypress/e2e/coo/02.acm_alerting_ui.cy.ts
  • web/cypress/e2e/monitoring/regression/01.reg_alerts_admin.cy.ts
  • web/cypress/fixtures/coo/acm-install.sh
  • web/cypress/fixtures/monitoring/constants.ts
  • web/cypress/support/commands/utility-commands.ts
  • web/cypress/support/monitoring/01.reg_alerts.cy.ts
  • web/cypress/support/monitoring/04.reg_alerts_namespace.cy.ts
  • web/cypress/views/alerting-rule-list-page.ts
  • web/cypress/views/incidents-page.ts
  • web/cypress/views/list-page.ts
  • web/cypress/views/nav.ts
  • web/cypress/views/silences-list-page.ts
💤 Files with no reviewable changes (1)
  • web/cypress/views/silences-list-page.ts

Comment thread web/cypress/e2e/coo/02.acm_alerting_ui.cy.ts
@etmurasaki

Copy link
Copy Markdown
Contributor Author

/test e2e-monitoring

@etmurasaki etmurasaki changed the title OU-1107: ACM alerting UI with alerts and perses OU-1107 OU-1108: ACM alerting UI with alerts and perses Jul 30, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 30, 2026

Copy link
Copy Markdown

@etmurasaki: This pull request references OU-1107 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.

This pull request references OU-1108 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 by CodeRabbit

  • Bug Fixes
  • Improved Alerting behavior across Core Platform and Fleet Management perspectives.
  • Alert filtering, silencing, expiration, and detail-page actions now work correctly with perspective-specific alerts.
  • Corrected empty-state displays for alerting rules and silences.
  • Improved navigation and filter interactions by ensuring controls are visible before selection.
  • Fleet Management now correctly hides unsupported Incidents and Signal correlation options.
  • Enhancements
  • Enabled Incidents and Perses monitoring components for supported environments.

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.

@etmurasaki

Copy link
Copy Markdown
Contributor Author

/test e2e-monitoring

@etmurasaki

Copy link
Copy Markdown
Contributor Author

/test e2e-alerts

@openshift-ci

openshift-ci Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: etmurasaki

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

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@etmurasaki

Copy link
Copy Markdown
Contributor Author

/test e2e-coo

@etmurasaki

Copy link
Copy Markdown
Contributor Author

/test e2e-perses

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (1)
web/cypress/views/list-page.ts (1)

109-114: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Keep the optional clear-all lookup retriable.

cy.get('body').then(...) performs a single DOM check. If DataViewToolbar-clear-all-filters renders after the callback, clearAllFilters returns without clearing active filters. Wait for a settled DataView state before the optional lookup, or use a bounded retry that treats a settled no-filter state as the absent case.

🤖 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 `@web/cypress/views/list-page.ts` around lines 109 - 114, Update
clearAllFilters around the DataViewToolbar-clear-all-filters lookup so it
remains retriable until the DataView settles, while allowing a settled state
with no clear-all control to complete successfully. Avoid relying on the single
body snapshot from cy.get('body').then(...); preserve the existing behavior of
clicking the first matching control when it appears.
🤖 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 `@web/cypress/e2e/coo/02.acm_perses.cy.ts`:
- Around line 22-28: Add a beforeEach hook alongside the existing before hook
that switches to the Fleet management perspective and navigates through Observe
> Dashboards before every BVT case, using the existing switchPerspective and
nav.sidenav helpers. Keep the one-time ACM setup and dashboard cleanup in before
unchanged.

In `@web/cypress/e2e/monitoring/regression/01.reg_alerts_admin.cy.ts`:
- Line 18: Update the suite metadata in the test file to match the Core platform
perspective being used. Change the describe block title and the comment text
around lines 31-33 from references to Administrator to Core platform, so the
Cypress reports and test labels accurately reflect that the test executes
cy.switchPerspective('Core platform') rather than an Administrator perspective
test.

In `@web/cypress/e2e/perses/00.coo_bvt_perses_admin.cy.ts`:
- Line 38: Rename the `describe` suite title in the Perses admin Cypress spec
from `Administrator perspective` to `Core platform` so CI reports match the
configured perspective and generated test names.

In `@web/cypress/support/perses/01.coo_list_perses_admin.cy.ts`:
- Line 28: Update every shouldBeLoaded call in the test file to pass
perspective.dashboardsPageName, matching the existing first scenario, so each
list-load assertion uses the configured page name.

In `@web/cypress/support/perses/99.coo_rbac_perses_user5.cy.ts`:
- Line 19: Remove the unused perspective fields dashboardsPageName and
dashboardSearch from the relevant test data declarations in
web/cypress/support/perses/99.coo_rbac_perses_user5.cy.ts:19-19 and
web/cypress/support/perses/99.coo_rbac_perses_user6.cy.ts:6-6, unless you
instead wire both fields into their corresponding tests.

---

Nitpick comments:
In `@web/cypress/views/list-page.ts`:
- Around line 109-114: Update clearAllFilters around the
DataViewToolbar-clear-all-filters lookup so it remains retriable until the
DataView settles, while allowing a settled state with no clear-all control to
complete successfully. Avoid relying on the single body snapshot from
cy.get('body').then(...); preserve the existing behavior of clicking the first
matching control when it appears.
🪄 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: Enterprise

Run ID: bf92b12a-d8ac-4a94-a665-fa5dcc34654f

📥 Commits

Reviewing files that changed from the base of the PR and between 49ec998 and ad6b4e9.

📒 Files selected for processing (40)
  • web/cypress/e2e/coo/02.acm_alerting_ui.cy.ts
  • web/cypress/e2e/coo/02.acm_perses.cy.ts
  • web/cypress/e2e/monitoring/regression/01.reg_alerts_admin.cy.ts
  • web/cypress/e2e/perses/00.coo_bvt_perses_admin.cy.ts
  • web/cypress/e2e/perses/01.coo_list_perses_admin.cy.ts
  • web/cypress/e2e/perses/02.coo_edit_perses_admin.cy.ts
  • web/cypress/e2e/perses/03.coo_create_perses_admin.cy.ts
  • web/cypress/e2e/perses/04.coo_import_perses_admin.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user1.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user2.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user3.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user4.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user5.cy.ts
  • web/cypress/fixtures/coo/acm-alerrule-test.yaml
  • web/cypress/fixtures/coo/acm-install.sh
  • web/cypress/fixtures/coo/acm-uiplugin.yaml
  • web/cypress/support/commands/auth-commands.ts
  • web/cypress/support/commands/operator-commands.ts
  • web/cypress/support/commands/utility-commands.ts
  • web/cypress/support/monitoring/01.reg_alerts.cy.ts
  • web/cypress/support/perses/00.coo_bvt_perses_admin.cy.ts
  • web/cypress/support/perses/01.coo_list_perses_admin.cy.ts
  • web/cypress/support/perses/01.coo_list_perses_admin_namespace.cy.ts
  • web/cypress/support/perses/02.coo_edit_perses_admin.cy.ts
  • web/cypress/support/perses/02.coo_edit_perses_admin_1.cy.ts
  • web/cypress/support/perses/03.coo_create_perses_admin.cy.ts
  • web/cypress/support/perses/04.coo_import_perses_admin.cy.ts
  • web/cypress/support/perses/05.coo_create_import_perses_admin.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user1.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user2.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user3.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user4.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user5.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user6.cy.ts
  • web/cypress/views/list-page.ts
  • web/cypress/views/nav.ts
  • web/cypress/views/perses-dashboards-edit-variables.ts
  • web/cypress/views/perses-dashboards-list-dashboards.ts
  • web/cypress/views/silence-alert-page.ts
  • web/src/shared/constants/data-test.ts
💤 Files with no reviewable changes (2)
  • web/cypress/support/commands/operator-commands.ts
  • web/src/shared/constants/data-test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • web/cypress/support/commands/utility-commands.ts
  • web/cypress/e2e/coo/02.acm_alerting_ui.cy.ts
  • web/cypress/support/monitoring/01.reg_alerts.cy.ts
  • web/cypress/views/nav.ts

Comment thread web/cypress/e2e/coo/02.acm_perses.cy.ts
Comment thread web/cypress/e2e/monitoring/regression/01.reg_alerts_admin.cy.ts
Comment thread web/cypress/e2e/perses/00.coo_bvt_perses_admin.cy.ts
Comment thread web/cypress/support/perses/01.coo_list_perses_admin.cy.ts
Comment thread web/cypress/support/perses/99.coo_rbac_perses_user5.cy.ts
@etmurasaki

Copy link
Copy Markdown
Contributor Author

/test e2e-perses

@etmurasaki

Copy link
Copy Markdown
Contributor Author

/test e2e-coo

@etmurasaki

Copy link
Copy Markdown
Contributor Author

/test e2e-coo

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (1)
web/cypress/support/commands/image-patch-commands.ts (1)

125-168: 🚀 Performance & Scalability | 🔵 Trivial | ⚖️ Poor tradeoff

Reconsider re-invoking the full patch script inside the outer retry loop.

On a mismatch, checkAndFix re-runs the entire update-mcp-image.sh script — which now has its own internal 6-attempt CSV retry loop and a fixed wait — and then separately patches the deployment and waits for rollout and pod readiness again. With maxAttempts = 5 outer retries, worst-case this compounds the shell script's own retries, multiplying total CI runtime and API calls.

Consider having the script perform only the CSV patch (skip its own polling loop) when invoked from this retry wrapper, since checkAndFix already implements outer retry and readiness waiting.

🤖 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 `@web/cypress/support/commands/image-patch-commands.ts` around lines 125 - 168,
Update the retry flow in checkAndFix so invoking update-mcp-image.sh performs
only the CSV patch without its internal polling/retry loop when called from this
wrapper. Pass the appropriate script option or environment flag, while
preserving the existing deployment patch, rollout, pod-readiness checks, and
outer retry behavior.
🤖 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 `@web/cypress/fixtures/coo/update-mcp-image.sh`:
- Line 44: Update the image verification check in the shell conditional around
LIVE_CSV and MCP_CONSOLE_IMAGE to use grep’s fixed-string option, ensuring the
image reference is matched literally rather than interpreted as a regular
expression.
- Line 9: Update the COO_CSV_NAME lookup in update-mcp-image.sh to validate that
at least one CSV was found and fail with a clear error if none exists. When
multiple matches are returned during an upgrade, select one deterministic CSV
name before patch_csv and the verification loop use it, ensuring COO_CSV_NAME is
always a single line.
- Around line 64-67: Update the oc wait handling in update-mcp-image.sh to
capture its exit status and explicitly exit non-zero when waiting for the
observability-operator pods fails or times out. Ensure the subsequent echo does
not mask the failure, while preserving output for successful waits.
- Around line 33-56: Reduce the total wait budget in the update-MCP-image
script, especially the CSV verification loop around MAX_CSV_RETRIES and
CSV_RETRY_INTERVAL, so it completes within the callers’ 120-second cy.exec
readyTimeoutMilliseconds, accounting for the existing oc wait and command
overhead. Preserve the retry and verification behavior while ensuring the
maximum runtime stays below the timeout.

In `@web/cypress/support/commands/image-patch-commands.ts`:
- Around line 101-159: Update the `checkAndFix` command execution flow to
eliminate shell interpolation of `MCP.namespace`, `deployName`, `expectedImage`,
and `kubeconfig`. Use static command strings with quoted environment-variable
expansions, pass `kubeconfig` via `env.KUBECONFIG`, and validate dynamic
Kubernetes names and image references against appropriate allow-lists before
invoking `cy.exec`.

---

Nitpick comments:
In `@web/cypress/support/commands/image-patch-commands.ts`:
- Around line 125-168: Update the retry flow in checkAndFix so invoking
update-mcp-image.sh performs only the CSV patch without its internal
polling/retry loop when called from this wrapper. Pass the appropriate script
option or environment flag, while preserving the existing deployment patch,
rollout, pod-readiness checks, and outer retry behavior.
🪄 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: Enterprise

Run ID: 40146f88-9b03-41cb-bb57-246774ff3131

📥 Commits

Reviewing files that changed from the base of the PR and between bbeac96 and 02a9aa8.

📒 Files selected for processing (3)
  • web/cypress/fixtures/coo/update-mcp-image.sh
  • web/cypress/support/commands/image-patch-commands.ts
  • web/cypress/support/commands/operator-commands.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/cypress/support/commands/operator-commands.ts

# Generate a random filename
RANDOM_FILE="/tmp/coo_monitoring_csv_$(date +%s%N).yaml"

COO_CSV_NAME=$(oc get csv --kubeconfig "${KUBECONFIG}" --namespace="${MCP_NAMESPACE}" | grep "cluster-observability-operator" | awk '{print $1}')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Guard against empty or multi-line COO_CSV_NAME.

grep "cluster-observability-operator" | awk '{print $1}' can return zero or multiple matches if two CSV versions coexist during an OLM upgrade. An empty result makes the later oc get csv "" call fail with an unclear error. A multi-line result makes COO_CSV_NAME hold more than one CSV name, which breaks the oc get csv "${COO_CSV_NAME}" calls in patch_csv and the verification loop.

Add a check after the lookup, and select a single, deterministic CSV when more than one match exists.

🔧 Proposed fix
-COO_CSV_NAME=$(oc get csv --kubeconfig "${KUBECONFIG}" --namespace="${MCP_NAMESPACE}" | grep "cluster-observability-operator" | awk '{print $1}')
+COO_CSV_NAME=$(oc get csv --kubeconfig "${KUBECONFIG}" --namespace="${MCP_NAMESPACE}" | grep "cluster-observability-operator" | awk '{print $1}' | sort -V | tail -1)
 echo "COO_CSV_NAME: ${COO_CSV_NAME}"
+if [ -z "${COO_CSV_NAME}" ]; then
+  echo "ERROR: could not find cluster-observability-operator CSV in namespace ${MCP_NAMESPACE}"
+  exit 1
+fi
🤖 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 `@web/cypress/fixtures/coo/update-mcp-image.sh` at line 9, Update the
COO_CSV_NAME lookup in update-mcp-image.sh to validate that at least one CSV was
found and fail with a clear error if none exists. When multiple matches are
returned during an upgrade, select one deterministic CSV name before patch_csv
and the verification loop use it, ensuring COO_CSV_NAME is always a single line.

Comment on lines +33 to +56
# Verify the CSV patch was applied and not reverted by OLM.
# OLM may reconcile the CSV and revert the image back to the original.
MAX_CSV_RETRIES=6
CSV_RETRY_INTERVAL=10
CSV_PATCHED=false

for i in $(seq 1 $MAX_CSV_RETRIES); do
sleep $CSV_RETRY_INTERVAL

LIVE_CSV=$(oc get csv "${COO_CSV_NAME}" -n "${MCP_NAMESPACE}" -o yaml --kubeconfig "${KUBECONFIG}")

if echo "${LIVE_CSV}" | grep -q "${MCP_CONSOLE_IMAGE}"; then
echo "CSV patch verified successfully on attempt ${i}"
CSV_PATCHED=true
break
fi

echo "CSV patch was reverted by OLM (attempt ${i}/${MAX_CSV_RETRIES}). Re-applying..."
patch_csv
done

if [ "${CSV_PATCHED}" = false ]; then
echo "WARNING: CSV patch could not be stabilized after ${MAX_CSV_RETRIES} attempts"
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Find the Cypress config value for readyTimeoutMilliseconds to compare against the script's new worst-case runtime.
rg -n "readyTimeoutMilliseconds" -C3

Repository: openshift/monitoring-plugin

Length of output: 165


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- candidate files ---'
git ls-files | rg '(^|/)(update-mcp-image\.sh|image-patch-commands\.ts|cypress|config)' | head -200
printf '%s\n' '--- timeout-related references ---'
rg -n -i "readyTimeoutMilliseconds|timeout.*milliseconds|cy\.exec|patchCOOCSVImage|verifyMonitoringConsolePluginImage" --glob '!node_modules' .
printf '%s\n' '--- script ---'
cat -n web/cypress/fixtures/coo/update-mcp-image.sh

Repository: openshift/monitoring-plugin

Length of output: 37697


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- Cypress timeout configuration ---'
cat -n web/cypress.config.ts | sed -n '52,72p'
printf '%s\n' '--- image patch commands ---'
cat -n web/cypress/support/commands/image-patch-commands.ts | sed -n '1,215p'
printf '%s\n' '--- call sites ---'
cat -n web/cypress/support/commands/operator-commands.ts | sed -n '225,255p'
printf '%s\n' '--- script timing constants and waits ---'
rg -n "sleep|oc wait|MAX_CSV_RETRIES|CSV_RETRY_INTERVAL|timeout:" web/cypress/fixtures/coo/update-mcp-image.sh web/cypress/support/commands/image-patch-commands.ts

Repository: openshift/monitoring-plugin

Length of output: 12263


Increase the cy.exec timeout or reduce the script wait budget.

readyTimeoutMilliseconds is 120 seconds, but the script can spend at least 145 seconds in sleeps and oc wait, before command overhead. Both callers use this timeout. failOnNonZeroExit: false does not prevent a timeout failure.

🤖 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 `@web/cypress/fixtures/coo/update-mcp-image.sh` around lines 33 - 56, Reduce
the total wait budget in the update-MCP-image script, especially the CSV
verification loop around MAX_CSV_RETRIES and CSV_RETRY_INTERVAL, so it completes
within the callers’ 120-second cy.exec readyTimeoutMilliseconds, accounting for
the existing oc wait and command overhead. Preserve the retry and verification
behavior while ensuring the maximum runtime stays below the timeout.


LIVE_CSV=$(oc get csv "${COO_CSV_NAME}" -n "${MCP_NAMESPACE}" -o yaml --kubeconfig "${KUBECONFIG}")

if echo "${LIVE_CSV}" | grep -q "${MCP_CONSOLE_IMAGE}"; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use literal-string matching for the image verification check.

grep -q "${MCP_CONSOLE_IMAGE}" interprets the image reference as a basic regular expression. The . characters in a typical image reference (registry host, tag) are regex metacharacters, so this check can produce a false-positive match against a similar but different image string.

Use grep -qF to match the image reference as a literal string.

🔧 Proposed fix
-  if echo "${LIVE_CSV}" | grep -q "${MCP_CONSOLE_IMAGE}"; then
+  if echo "${LIVE_CSV}" | grep -qF "${MCP_CONSOLE_IMAGE}"; then
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if echo "${LIVE_CSV}" | grep -q "${MCP_CONSOLE_IMAGE}"; then
if echo "${LIVE_CSV}" | grep -qF "${MCP_CONSOLE_IMAGE}"; then
🤖 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 `@web/cypress/fixtures/coo/update-mcp-image.sh` at line 44, Update the image
verification check in the shell conditional around LIVE_CSV and
MCP_CONSOLE_IMAGE to use grep’s fixed-string option, ensuring the image
reference is matched literally rather than interpreted as a regular expression.

Comment on lines 64 to +67
# Wait for the operator to reconcile the change and make sure all the pods are running.
sleep 25
OUTPUT=`oc wait --for=condition=ready pods -l app.kubernetes.io/name=observability-operator -n "${MCP_NAMESPACE}" --timeout=60s --kubeconfig "${KUBECONFIG}"`
echo "${OUTPUT}" No newline at end of file
OUTPUT=$(oc wait --for=condition=ready pods -l app.kubernetes.io/name=observability-operator -n "${MCP_NAMESPACE}" --timeout=60s --kubeconfig "${KUBECONFIG}")
echo "${OUTPUT}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check for a `set -e`/`set -euo pipefail` directive at the top of the script.
sed -n '1,3p' web/cypress/fixtures/coo/update-mcp-image.sh

Repository: openshift/monitoring-plugin

Length of output: 264


🏁 Script executed:

#!/bin/bash
set -u

printf '%s\n' '--- update-mcp-image.sh ---'
sed -n '1,140p' web/cypress/fixtures/coo/update-mcp-image.sh

printf '%s\n' '--- references ---'
rg -n -C 5 'update-mcp-image\.sh|patchCOOCSVImage|cy\.exec' web/cypress

Repository: openshift/monitoring-plugin

Length of output: 50384


🏁 Script executed:

#!/bin/bash
set -u

printf '%s\n' '--- patchCOOCSVImage and script invocation ---'
rg -n -C 12 'patchCOOCSVImage|update-mcp-image\.sh|MCP_CONSOLE_IMAGE' web/cypress/support web/cypress/e2e web/cypress --glob '*.ts' --glob '*.js' --glob '*.sh' | head -n 240

printf '%s\n' '--- direct wait-status behavior ---'
bash -c 'tmp=$(mktemp); printf "%s\n" "#!/bin/bash" "OUTPUT=\$(false)" "echo \"\${OUTPUT}\"" > "$tmp"; chmod +x "$tmp"; "$tmp"; printf "exit=%s\n" "$?"; rm -f "$tmp"'

Repository: openshift/monitoring-plugin

Length of output: 20329


Propagate oc wait failures from update-mcp-image.sh.

The script has no set -e or set -euo pipefail. A failed or timed-out oc wait is followed by a successful echo, so the script returns exit code 0. Check the wait status explicitly and exit non-zero when the operator pods are not ready.

🤖 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 `@web/cypress/fixtures/coo/update-mcp-image.sh` around lines 64 - 67, Update
the oc wait handling in update-mcp-image.sh to capture its exit status and
explicitly exit non-zero when waiting for the observability-operator pods fails
or times out. Ensure the subsequent echo does not mask the failure, while
preserving output for successful waits.

Comment on lines +101 to +159
const checkAndFix = (attempt: number): void => {
cy.exec(
`oc get pods -l app.kubernetes.io/instance=monitoring -n ${MCP.namespace} ` +
`-o jsonpath='{.items[0].spec.containers[0].image}' --kubeconfig "${kubeconfig}"`,
{ failOnNonZeroExit: false },
).then((result) => {
const currentImage = result.stdout.replace(/'/g, '').trim();
cy.log(
`monitoring-console-plugin image check ` +
`(attempt ${attempt}/${maxAttempts}): ${currentImage}`,
);

if (currentImage === expectedImage) {
cy.log('monitoring-console-plugin pod image verified successfully');
return;
}

if (attempt >= maxAttempts) {
throw new Error(
`monitoring-console-plugin pod image mismatch after ${maxAttempts} attempts.\n` +
`Expected: ${expectedImage}\nActual: ${currentImage}`,
);
}

cy.log('Image mismatch detected. Re-patching CSV and deployment...');

// Re-run the CSV patch script
cy.exec('./cypress/fixtures/coo/update-mcp-image.sh', {
env: {
MCP_CONSOLE_IMAGE: expectedImage,
KUBECONFIG: kubeconfig,
MCP_NAMESPACE: MCP.namespace,
},
timeout: readyTimeoutMilliseconds,
failOnNonZeroExit: false,
});

// Patch the deployment directly in case the operator doesn't reconcile
cy.exec(
`oc get deployment -l app.kubernetes.io/instance=monitoring -n ${MCP.namespace} ` +
`-o jsonpath='{.items[0].metadata.name}' --kubeconfig "${kubeconfig}"`,
{ failOnNonZeroExit: false },
).then((deployResult) => {
const deployName = deployResult.stdout.replace(/'/g, '').trim();
if (deployName) {
cy.log(`Patching deployment/${deployName} image directly`);
cy.exec(
`oc patch deployment ${deployName} -n ${MCP.namespace} --type=json ` +
`-p '[{"op":"replace","path":"/spec/template/spec/containers/0/image",` +
`"value":"${expectedImage}"}]' ` +
`--kubeconfig "${kubeconfig}"`,
);
cy.exec(
`oc rollout status deployment/${deployName} -n ${MCP.namespace} ` +
`--timeout=120s --kubeconfig "${kubeconfig}"`,
{ timeout: 130000 },
);
}
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

file='web/cypress/support/commands/image-patch-commands.ts'
printf '%s\n' '--- target file ---'
sed -n '1,190p' "$file"

printf '%s\n' '--- related definitions and call sites ---'
rg -n -C 3 'checkAndFix|expectedImage|patchCOOCSVImage|MCP\.namespace|image-patch-commands' web/cypress web --glob '*.{ts,tsx,js,sh}' | head -n 500

printf '%s\n' '--- fixture script ---'
script='web/cypress/fixtures/coo/update-mcp-image.sh'
if [ -f "$script" ]; then
  sed -n '1,220p' "$script"
fi

Repository: openshift/monitoring-plugin

Length of output: 50383


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- relevant environment definitions and call sites ---'
rg -n -C 4 \
  'MCP_CONSOLE_IMAGE|KUBECONFIG_PATH|namespace:|verifyMonitoringConsolePluginImage|setupMonitoringConsolePlugin' \
  web/cypress --glob '*.{ts,tsx,js,json,yaml,yml,sh}' \
  | grep -E 'MCP_CONSOLE_IMAGE|KUBECONFIG_PATH|verifyMonitoringConsolePluginImage|setupMonitoringConsolePlugin|namespace:' \
  | head -n 300

printf '%s\n' '--- image update script ---'
script='web/cypress/fixtures/coo/update-mcp-image.sh'
wc -l "$script"
cat -n "$script"

printf '%s\n' '--- Cypress exec implementation references ---'
rg -n -C 3 'cy\.exec|exec\(' web/cypress package.json cypress.config.* .github 2>/dev/null \
  | head -n 250

printf '%s\n' '--- shell parsing probe ---'
python3 - <<'PY'
import subprocess

contexts = {
    "namespace_get_pods": (
        'printf "%s\\n" oc get pods -l app.kubernetes.io/instance=monitoring '
        '-n {value} -o jsonpath=\'{{.items[0].spec.containers[0].image}}\' '
        '--kubeconfig "/tmp/kubeconfig"'
    ),
    "kubeconfig_get_pods": (
        'printf "%s\\n" oc get pods -n safe '
        '-o jsonpath=\'{{.items[0].spec.containers[0].image}}\' '
        '--kubeconfig "{value}"'
    ),
    "deploy_patch": (
        'printf "%s\\n" oc patch deployment {deploy} -n safe --type=json '
        '-p \'[{{"op":"replace","path":"/spec/template/spec/containers/0/image",'
        '"value":"{image}"}}]\' --kubeconfig "/tmp/kubeconfig"'
    ),
}
values = {
    "safe_namespace": "monitoring",
    "bad_namespace": 'safe; printf INJECTED',
    "safe_kubeconfig": "/tmp/kubeconfig",
    "bad_kubeconfig": '/tmp/kube"; printf INJECTED; #',
    "safe_deploy": "monitoring-console-plugin",
    "bad_deploy": 'safe; printf INJECTED',
    "safe_image": "quay.io/example/console@sha256:" + "a" * 64,
    "bad_image": 'quay.io/example/console:tag\' ; printf INJECTED; #',
}
for name, template in contexts.items():
    print(f"--- {name} ---")
    cases = {
        "safe": template.format(
            value=values["safe_namespace"] if "namespace" in name
            else values["safe_kubeconfig"] if "kubeconfig" in name
            else values["safe_deploy"],
            deploy=values["safe_deploy"],
            image=values["safe_image"],
        ),
        "malicious": template.format(
            value=values["bad_namespace"] if "namespace" in name
            else values["bad_kubeconfig"] if "kubeconfig" in name
            else values["bad_deploy"],
            deploy=values["bad_deploy"],
            image=values["bad_image"],
        ),
    }
    for label, command in cases.items():
        result = subprocess.run(["bash", "-c", command], text=True,
                                capture_output=True, check=False)
        print(label, "stdout:", repr(result.stdout), "stderr:", repr(result.stderr),
              "code:", result.returncode)
PY

Repository: openshift/monitoring-plugin

Length of output: 50383


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- configure-env.sh relevant sections ---'
sed -n '190,235p' web/cypress/configure-env.sh
sed -n '255,300p' web/cypress/configure-env.sh
sed -n '365,390p' web/cypress/configure-env.sh
sed -n '430,455p' web/cypress/configure-env.sh

printf '%s\n' '--- exact image verification call sites ---'
rg -n -C 8 'verifyMonitoringConsolePluginImage|setupMonitoringConsolePlugin' \
  web/cypress/e2e web/cypress/support --glob '*.{ts,tsx}' | head -n 220

printf '%s\n' '--- concise shell parsing probe ---'
python3 - <<'PY'
import subprocess

def run(label, command):
    r = subprocess.run(["bash", "-c", command], text=True,
                       capture_output=True, check=False)
    print(label, "=>", repr(r.stdout), "code=", r.returncode,
          "stderr=", repr(r.stderr))

run("namespace-safe",
    "printf '%s\\n' oc get pods -n monitoring --kubeconfig '/tmp/kubeconfig'")
run("namespace-injection",
    "printf '%s\\n' oc get pods -n safe; printf '%s\\n' INJECTED --kubeconfig '/tmp/kubeconfig'")

run("kubeconfig-safe",
    'printf "%s\\n" oc get pods --kubeconfig "/tmp/kubeconfig"')
run("kubeconfig-injection",
    'printf "%s\\n" oc get pods --kubeconfig "/tmp/kube"; printf "%s\\n" INJECTED; # "')

run("deployment-safe",
    "printf '%s\\n' oc patch deployment monitoring-console-plugin -n safe")
run("deployment-injection",
    "printf '%s\\n' oc patch deployment safe; printf '%s\\n' INJECTED -n safe")

run("image-safe",
    """printf '%s\\n' 'oc patch -p '[{"op":"replace","value":"quay.io/example/plugin:tag"}]''""")
run("image-single-quote",
    """printf '%s\\n' 'oc patch -p '[{"op":"replace","value":"safe'"'"'; printf "%s\\n" INJECTED; #"}]''""")
PY

Repository: openshift/monitoring-plugin

Length of output: 12491


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- MCP construction and type declarations ---'
rg -n -C 10 \
  'const MCP|let MCP|MCP\s*=|COO_NAMESPACE|namespace:\s*Cypress\.env|interface.*MCP|type.*MCP' \
  web/cypress --glob '*.{ts,tsx}' | head -n 260

printf '%s\n' '--- workflow and script sources for relevant environment values ---'
rg -n -C 6 \
  'CYPRESS_(MCP_CONSOLE_IMAGE|COO_NAMESPACE|KUBECONFIG_PATH)|MCP_CONSOLE_IMAGE|COO_NAMESPACE|KUBECONFIG_PATH' \
  .github web --glob '*.{yml,yaml,sh,ts,tsx,json}' \
  | grep -vE 'fixtures/incident-scenarios|fixtures/virtualization|fixtures/coo/logging' \
  | head -n 300

printf '%s\n' '--- exact target command strings ---'
sed -n '96,158p' web/cypress/support/commands/image-patch-commands.ts

printf '%s\n' '--- Kubernetes-style allow-list probe ---'
python3 - <<'PY'
import re
patterns = {
    "namespace_or_deployment_dns_label": re.compile(r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"),
    "dns_subdomain": re.compile(r"^[a-z0-9]([-a-z0-9.]*[a-z0-9])?$"),
}
values = [
    "openshift-cluster-observability-operator",
    "monitoring-console-plugin",
    "safe; printf INJECTED",
    "name with spaces",
    "name'withquote",
]
for value in values:
    print(repr(value), {
        name: bool(pattern.fullmatch(value))
        for name, pattern in patterns.items()
    })
PY

Repository: openshift/monitoring-plugin

Length of output: 49043


Remove shell interpolation of runtime values.

MCP.namespace, deployName, expectedImage, and kubeconfig can alter these cy.exec commands. Use static command strings with quoted environment-variable expansions, or reject values that fail Kubernetes name and image-reference allow-lists before execution. Pass kubeconfig through env.KUBECONFIG instead of interpolating it.

🧰 Tools
🪛 OpenGrep (1.26.0)

[ERROR] 102-106: Dynamic command passed to child_process.exec/execSync. Use child_process.execFile or spawn with an argument array instead.

(coderabbit.command-injection.exec-js)


[ERROR] 139-143: Dynamic command passed to child_process.exec/execSync. Use child_process.execFile or spawn with an argument array instead.

(coderabbit.command-injection.exec-js)


[ERROR] 147-152: Dynamic command passed to child_process.exec/execSync. Use child_process.execFile or spawn with an argument array instead.

(coderabbit.command-injection.exec-js)


[ERROR] 153-157: Dynamic command passed to child_process.exec/execSync. Use child_process.execFile or spawn with an argument array instead.

(coderabbit.command-injection.exec-js)

🤖 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 `@web/cypress/support/commands/image-patch-commands.ts` around lines 101 - 159,
Update the `checkAndFix` command execution flow to eliminate shell interpolation
of `MCP.namespace`, `deployName`, `expectedImage`, and `kubeconfig`. Use static
command strings with quoted environment-variable expansions, pass `kubeconfig`
via `env.KUBECONFIG`, and validate dynamic Kubernetes names and image references
against appropriate allow-lists before invoking `cy.exec`.

Sources: Path instructions, Linters/SAST tools

@etmurasaki

Copy link
Copy Markdown
Contributor Author

/test e2e-perses

@etmurasaki

Copy link
Copy Markdown
Contributor Author

/test e2e-alerts

@etmurasaki

Copy link
Copy Markdown
Contributor Author

/test e2e-virtualization

@etmurasaki

Copy link
Copy Markdown
Contributor Author

/test e2e-coo

@etmurasaki

Copy link
Copy Markdown
Contributor Author

/test e2e-perses

@openshift-ci

openshift-ci Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

@etmurasaki: 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/prow/e2e-virtualization 02a9aa8 link false /test e2e-virtualization
ci/prow/e2e-coo 0146fd2 link false /test e2e-coo
ci/prow/e2e-perses 0146fd2 link false /test e2e-perses
ci/prow/e2e-alerts 02a9aa8 link false /test e2e-alerts

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.

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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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.

2 participants