Skip to content

Add AI analysis to medik8s jobs - #82802

Merged
openshift-merge-bot[bot] merged 6 commits into
openshift:mainfrom
abrugaro:add-analyzer-to-medik8s-jobs
Aug 13, 2026
Merged

Add AI analysis to medik8s jobs#82802
openshift-merge-bot[bot] merged 6 commits into
openshift:mainfrom
abrugaro:add-analyzer-to-medik8s-jobs

Conversation

@abrugaro

@abrugaro abrugaro commented Aug 3, 2026

Copy link
Copy Markdown
Contributor
  • Add medik8s-analyze-e2e-failure step registry ref that uses Claude Code (via the pre-installed ai-helpers
    CI plugin) to automatically analyze E2E test failures for medik8s operators

  • Runs as a best_effort post-step: polls GCS for finished.json, invokes the
    /ci:prow-job-analysis skill when failures are detected, and writes a markdown analysis report to
    the artifact directory

  • For now wired only into NHC (4.22, 4.23, 5.0)

Forced an error to see the analysis in prow, see it here

Here is an example of a whole analysis: failure-analysis-sbr-77.md

Summary by CodeRabbit

Adds the medik8s-analyze-e2e-failure CI step for Medik8s operator E2E workflows.

The step polls GCS for test results, analyzes failures with Claude Code and the /ci:prow-job-analyze-test-failure skill, and writes a Markdown report to the artifact directory. It runs as a best-effort post-step with a 30-minute timeout.

The step is enabled for Fence Agents Remediation, Self Node Remediation, Machine Deletion Remediation, Node Healthcheck Operator, Node Maintenance Operator, and Storage-Based Remediation across their 4.22, 4.23, and 5.0 configurations.

Signed-off-by: Alejandro Brugarolas <abrugaro@redhat.com>
@openshift-ci openshift-ci Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 3, 2026
@openshift-ci

openshift-ci Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Hi @abrugaro. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@openshift-ci
openshift-ci Bot requested review from mpryc and razo7 August 3, 2026 11:54
@coderabbitai

coderabbitai Bot commented Aug 3, 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 adds a Claude-based Medik8s E2E failure-analysis step. It detects failed test steps, generates analysis artifacts, and runs after openshift-e2e across Medik8s workflow configurations.

Changes

Medik8s E2E failure analysis

Layer / File(s) Summary
Analysis step contract
ci-operator/step-registry/medik8s/analyze-e2e-failure/*
Defines the CI step, runtime settings, Vertex AI configuration, credentials, metadata, and ownership.
Failure detection and Claude analysis
ci-operator/step-registry/medik8s/analyze-e2e-failure/medik8s-analyze-e2e-failure-commands.sh
Builds GCS paths, polls test artifacts, identifies failures, invokes Claude’s Prow analysis skill, and writes analysis and usage data.
Workflow integration
ci-operator/config/medik8s/*/*.yaml
Adds the claude-ai-helpers image and the analysis post step to Medik8s openshift-e2e workflows across release variants.

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

Sequence Diagram(s)

sequenceDiagram
  participant ProwJob
  participant GCSArtifacts
  participant ClaudeCLI
  participant SharedDirectory
  ProwJob->>GCSArtifacts: Poll finished.json files
  GCSArtifacts-->>ProwJob: Return test status
  ProwJob->>ClaudeCLI: Run Prow failure-analysis skill
  ClaudeCLI-->>ProwJob: Stream analysis and usage metrics
  ProwJob->>SharedDirectory: Write reports and token data
Loading

Suggested labels: rehearsals-ack

Suggested reviewers: mpryc, razo7


Important

Pre-merge checks failed

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

❌ Failed checks (1 error)

Check name Status Explanation Resolution
No-Sensitive-Data-In-Logs ❌ Error The --verbose flag on the claude command (line 98) redirects stderr containing potentially sensitive data (auth headers, API tokens) to publicly accessible artifact files without filtering or redac... Remove the --verbose flag from line 98, or filter stderr to exclude authentication-related output before writing to ${ARTIFACT_DIR}/claude-failure-analysis.log.
✅ Passed checks (14 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 full PR diff adds only CI YAML, metadata, OWNERS, and shell files; it contains no Ginkgo It, Describe, Context, or When test-title declarations.
Test Structure And Quality ✅ Passed The PR changes only ci-operator YAML, metadata, OWNERS, and Bash files; it adds no Ginkgo test code or *_test.go files, so these test-quality requirements are not applicable.
Microshift Test Compatibility ✅ Passed The pull request adds CI YAML, metadata, and a shell post-step only; no new Ginkgo tests or test declarations were found in the changed files.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The PR changes only ci-operator YAML and an analysis shell step; the diff adds no Go test files or It/Describe/Context/When declarations, so SNO compatibility checks are not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed The full PR diff adds only ci-operator test configuration and an analysis step; added content has no deployment manifests, controllers, replicas, affinity, topology spread, selectors, tolerations,...
Ote Binary Stdout Contract ✅ Passed The full PR diff contains no Go or OTE process code; it adds YAML, metadata, and a separate post-step shell script, so the OTE stdout contract is not applicable.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR adds CI YAML and a shell post-step only; no new Ginkgo test or test source was added, so this compatibility check is not applicable.
No-Weak-Crypto ✅ Passed The analyzed script, step YAML, metadata, and CI wiring contain no MD5, SHA1, DES, RC4, Blowfish, ECB, custom crypto, or secret/token comparisons.
Container-Privileges ✅ Passed The PR adds no privileged container fields, host namespace settings, SYS_ADMIN capability, or allowPrivilegeEscalation; existing privileged PSA labels are unchanged test commands.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding AI-based E2E failure analysis to medik8s jobs.
✨ 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.

@abrugaro

abrugaro commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

/pj-rehearse pull-ci-medik8s-fence-agents-remediation-main-5.0-openshift-e2e

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

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

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

@abrugaro: needs-ok-to-test label found, no rehearsals will be run

@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/medik8s/analyze-e2e-failure/medik8s-analyze-e2e-failure-commands.sh`:
- Around line 33-44: Update the TEST_STEPS loop in the analysis polling flow so
a passed step does not immediately exit via the success branch. Track each
step’s passed status, continue scanning all configured steps for failures, and
exit successfully only after every step reports .passed == true; preserve
immediate failure handling when any step reports .passed == false.
- Around line 73-101: Restrict the Claude invocation in the analysis command to
a credential-isolated environment: remove credential-bearing variables such as
GOOGLE_APPLICATION_CREDENTIALS from the agent context, prevent Bash and WebFetch
from accessing or exfiltrating credentials, and allow only the artifact download
and report-writing operations required by the SYSTEM_PROMPT. Update the tool
configuration around the claude command while preserving its existing fast
analysis and artifact output 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: Pro Plus

Run ID: 01a6336e-0eb2-48ca-8775-3c563873e823

📥 Commits

Reviewing files that changed from the base of the PR and between 93510f9 and 20625e1.

📒 Files selected for processing (8)
  • ci-operator/config/medik8s/fence-agents-remediation/medik8s-fence-agents-remediation-main__5.0.yaml
  • ci-operator/config/medik8s/self-node-remediation/medik8s-self-node-remediation-main__4.22.yaml
  • ci-operator/config/medik8s/self-node-remediation/medik8s-self-node-remediation-main__4.23.yaml
  • ci-operator/config/medik8s/self-node-remediation/medik8s-self-node-remediation-main__5.0.yaml
  • ci-operator/step-registry/medik8s/analyze-e2e-failure/OWNERS
  • ci-operator/step-registry/medik8s/analyze-e2e-failure/medik8s-analyze-e2e-failure-commands.sh
  • ci-operator/step-registry/medik8s/analyze-e2e-failure/medik8s-analyze-e2e-failure-ref.metadata.json
  • ci-operator/step-registry/medik8s/analyze-e2e-failure/medik8s-analyze-e2e-failure-ref.yaml

@weshayutin

Copy link
Copy Markdown
Contributor

/ok-to-test

@openshift-ci openshift-ci Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 3, 2026
@abrugaro

abrugaro commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

/pj-rehearse pull-ci-medik8s-fence-agents-remediation-main-5.0-openshift-e2e

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

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

@weshayutin

Copy link
Copy Markdown
Contributor

@abrugaro oooh.. thank you :) waiting on results :) hopefully we have a failed test to observe

@abrugaro

abrugaro commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

/pj-rehearse pull-ci-medik8s-self-node-remediation-main-4.22-openshift-e2e

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

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

@weshayutin

Copy link
Copy Markdown
Contributor

@abrugaro doesn't seem like the ai ananlysis executed. Perhaps because the build log is in a diff location than original script. /me looks.

Signed-off-by: Alejandro Brugarolas <abrugaro@redhat.com>
@abrugaro

abrugaro commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

/pj-rehearse pull-ci-medik8s-self-node-remediation-main-4.22-openshift-e2e

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

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

Signed-off-by: Alejandro Brugarolas <abrugaro@redhat.com>
@abrugaro

abrugaro commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

/pj-rehearse pull-ci-medik8s-self-node-remediation-main-4.22-openshift-e2e

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

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

@abrugaro

abrugaro commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

/pj-rehearse pull-ci-medik8s-fence-agents-remediation-main-5.0-openshift-e2e

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

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

@abrugaro

abrugaro commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

/pj-rehearse pull-ci-medik8s-self-node-remediation-main-4.23-openshift-e2e

@openshift-ci

openshift-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@abrugaro: The following test 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/medik8s/self-node-remediation/main/4.22-openshift-e2e c1862a9 link unknown /pj-rehearse pull-ci-medik8s-self-node-remediation-main-4.22-openshift-e2e

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.

@razo7

razo7 commented Aug 9, 2026

Copy link
Copy Markdown
Member

I would prefer to see this in action for one operator instead of merging this change for all, even though I don't see any risk. I guess it is just me being pessimistic about AI post-review.
Having said that, I won't block on that, so LGTM

@abrugaro

Copy link
Copy Markdown
Contributor Author

I would prefer to see this in action for one operator instead of merging this change for all, even though I don't see any risk. I guess it is just me being pessimistic about AI post-review. Having said that, I won't block on that, so LGTM

@razo7 which operator would you like to begin with? I'll leave only that one and add the rest once we see it working as exected.

@razo7

razo7 commented Aug 10, 2026

Copy link
Copy Markdown
Member

I would prefer to see this in action for one operator instead of merging this change for all, even though I don't see any risk. I guess it is just me being pessimistic about AI post-review. Having said that, I won't block on that, so LGTM

@razo7 which operator would you like to begin with? I'll leave only that one and add the rest once we see it working as exected.

I think NHC/SBR/SNR since we have some upcoming/open features to test for them

Signed-off-by: Alejandro Brugarolas <abrugaro@redhat.com>
@abrugaro

Copy link
Copy Markdown
Contributor Author

/pj-rehearse pull-ci-medik8s-node-healthcheck-operator-main-4.22-openshift-e2e

@abrugaro

Copy link
Copy Markdown
Contributor Author

/pj-rehearse pull-ci-medik8s-node-healthcheck-operator-main-4.23-openshift-e2e

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

@abrugaro: your /pj-rehearse request was not processed because the request waited in queue for longer than 5 minutes. Please retry in a few minutes.

1 similar comment
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

@abrugaro: your /pj-rehearse request was not processed because the request waited in queue for longer than 5 minutes. Please retry in a few minutes.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

[REHEARSALNOTIFIER]
@abrugaro: 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
pull-ci-medik8s-node-healthcheck-operator-main-4.23-ci-bundle-my-bundle medik8s/node-healthcheck-operator presubmit Ci-operator config changed
pull-ci-medik8s-node-healthcheck-operator-main-4.23-images medik8s/node-healthcheck-operator presubmit Ci-operator config changed
pull-ci-medik8s-node-healthcheck-operator-main-4.23-openshift-e2e medik8s/node-healthcheck-operator presubmit Ci-operator config changed
pull-ci-medik8s-node-healthcheck-operator-main-4.23-test medik8s/node-healthcheck-operator presubmit Ci-operator config changed
pull-ci-medik8s-node-healthcheck-operator-main-5.0-ci-bundle-my-bundle medik8s/node-healthcheck-operator presubmit Ci-operator config changed
pull-ci-medik8s-node-healthcheck-operator-main-5.0-images medik8s/node-healthcheck-operator presubmit Ci-operator config changed
pull-ci-medik8s-node-healthcheck-operator-main-5.0-openshift-e2e medik8s/node-healthcheck-operator presubmit Ci-operator config changed
pull-ci-medik8s-node-healthcheck-operator-main-5.0-test medik8s/node-healthcheck-operator presubmit Ci-operator config changed
pull-ci-medik8s-node-healthcheck-operator-main-4.22-ci-bundle-my-bundle medik8s/node-healthcheck-operator presubmit Ci-operator config changed
pull-ci-medik8s-node-healthcheck-operator-main-4.22-images medik8s/node-healthcheck-operator presubmit Ci-operator config changed
pull-ci-medik8s-node-healthcheck-operator-main-4.22-openshift-e2e medik8s/node-healthcheck-operator presubmit Ci-operator config changed
pull-ci-medik8s-node-healthcheck-operator-main-4.22-test medik8s/node-healthcheck-operator presubmit 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.

@abrugaro

Copy link
Copy Markdown
Contributor Author

/pj-rehearse pull-ci-medik8s-node-healthcheck-operator-main-4.22-openshift-e2e

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

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

@abrugaro

Copy link
Copy Markdown
Contributor Author

/pj-rehearse pull-ci-medik8s-node-healthcheck-operator-main-5.0-openshift-e2e

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

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

@razo7

razo7 commented Aug 13, 2026

Copy link
Copy Markdown
Member

/pj-rehearse ack

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

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

@openshift-merge-bot openshift-merge-bot Bot added the rehearsals-ack Signifies that rehearsal jobs have been acknowledged label Aug 13, 2026

@razo7 razo7 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice work, I am eager to see that in action!
(it might be best to create a jira to track this work so we won't forget about other operators if we will want to include this new post step) @abrugaro

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 13, 2026
@razo7

razo7 commented Aug 13, 2026

Copy link
Copy Markdown
Member

/approve

@openshift-ci

openshift-ci Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abrugaro, razo7

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 13, 2026
@openshift-merge-bot
openshift-merge-bot Bot merged commit 5b82617 into openshift:main Aug 13, 2026
18 checks passed
@abrugaro
abrugaro deleted the add-analyzer-to-medik8s-jobs branch August 14, 2026 13:09
TimurMP pushed a commit to TimurMP/release that referenced this pull request Sep 5, 2026
* add AI analysis to medik8s jobs

Signed-off-by: Alejandro Brugarolas <abrugaro@redhat.com>

* add claude-ai-helper to job images

Signed-off-by: Alejandro Brugarolas <abrugaro@redhat.com>

* add forced failure

Signed-off-by: Alejandro Brugarolas <abrugaro@redhat.com>

* add forced failure

Signed-off-by: Alejandro Brugarolas <abrugaro@redhat.com>

* add ai analysis to all operators

Signed-off-by: Alejandro Brugarolas <abrugaro@redhat.com>

* leave nhc only

Signed-off-by: Alejandro Brugarolas <abrugaro@redhat.com>

---------

Signed-off-by: Alejandro Brugarolas <abrugaro@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. rehearsals-ack Signifies that rehearsal jobs have been acknowledged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants