Skip to content

feat(must-gather): add must-gather generate#223

Open
Meina-rh wants to merge 1 commit intoopenshift-eng:mainfrom
Meina-rh:generate_mustgather
Open

feat(must-gather): add must-gather generate#223
Meina-rh wants to merge 1 commit intoopenshift-eng:mainfrom
Meina-rh:generate_mustgather

Conversation

@Meina-rh
Copy link

@Meina-rh Meina-rh commented Dec 15, 2025

What this PR does / why we need it:

This PR adds /must-gather:generate command and interactively prompts to analyze data with /must-gather:analyze after collection

Which issue(s) this PR fixes:

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.

Summary by CodeRabbit

  • New Features

    • Added /must-gather:generate command to create diagnostic bundles from OpenShift clusters, enabling a complete generate-and-analyze workflow.
  • Documentation

    • Renamed plugin to "Must-Gather Plugin" and broadened docs to cover both generating and analyzing must-gather data.
    • Added comprehensive guide for the generate command: prerequisites, usage examples, output options, and generate→analyze workflow.

✏️ Tip: You can customize this high-level summary in your review settings.

@openshift-ci openshift-ci bot requested review from bentito and enxebre December 15, 2025 03:40
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 15, 2025

Walkthrough

Adds generation documentation to the must-gather plugin: README updated to include /must-gather:generate and generate-related workflow notes; a new commands/generate.md document provides a full specification, examples, and operational details for the generate command.

Changes

Cohort / File(s) Change Summary
Must-gather README
plugins/must-gather/README.md
Title and description broadened from analyzer-only to include generation; adds /must-gather:generate usage, requirements, default output path, notes on /must-gather:analyze and /prow-job:extract-must-gather.
Generate command documentation
plugins/must-gather/commands/generate.md
New file describing /must-gather:generate: purpose, synopsis, argument details (image, --dest-dir), implementation steps (prereqs, image selection, output dir handling, execution, progress reporting), return values, examples, permissions/behavior notes, and related links.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Documentation-only changes but include a detailed new command spec that should be checked for accuracy.
  • Areas to inspect closely:
    • Examples and default --dest-dir path correctness and consistency with tooling.
    • Command argument descriptions (image selection logic) and prerequisites/permission statements.
    • Any references to other plugins/commands (/prow-job:extract-must-gather, /must-gather:analyze) for correct naming and linkage.

Pre-merge checks and finishing touches

✅ Passed checks (7 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(must-gather): add must-gather generate' clearly and specifically describes the main change: adding the must-gather generate command functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
No Real People Names In Style References ✅ Passed Documentation contains only technical content, command specifications, and usage examples with no personality-based styling references.
No Assumed Git Remote Names ✅ Passed PR does not contain hardcoded git remote names like 'origin' or 'upstream'. Only OpenShift/Kubernetes commands and Docker image references present.
Git Push Safety Rules ✅ Passed The pull request and review comments do not involve any git push operations, force pushes, or automated push workflows.
No Untrusted Mcp Servers ✅ Passed PR contains only documentation updates for must-gather plugin with no MCP server installations, dependencies, or configurations.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@openshift-ci
Copy link

openshift-ci bot commented Dec 15, 2025

Hi @Meina-rh. Thanks for your PR.

I'm waiting for a github.com 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 added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Dec 15, 2025
@Meina-rh
Copy link
Author

/ok-to-test

@openshift-ci
Copy link

openshift-ci bot commented Dec 15, 2025

@Meina-rh: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/ok-to-test

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between f0e0326 and 1c08a25.

📒 Files selected for processing (2)
  • plugins/must-gather/README.md (2 hunks)
  • plugins/must-gather/commands/generate.md (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
plugins/must-gather/commands/generate.md

10-10: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


56-56: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


62-62: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


67-67: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


72-72: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


77-77: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


93-93: Bare URL used

(MD034, no-bare-urls)

plugins/must-gather/README.md

259-259: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (2)
plugins/must-gather/commands/generate.md (1)

14-46: Clarify whether Implementation section is prescriptive or descriptive.

The Implementation section (lines 21–46) reads as detailed pseudocode or a specification for how the command should be implemented. If this documentation is meant to guide the actual implementation of the /must-gather:generate command, ensure that the implementation in the actual plugin code strictly follows these steps, particularly around error handling for prerequisites and image determination logic. If this is already implemented, confirm that the code matches this documented behavior.

plugins/must-gather/README.md (1)

256-282: Documentation integration is well-structured and consistent.

The new /must-gather:generate command is well-integrated into the README with clear examples, requirements, and workflow guidance. The documentation aligns with the detailed specification in generate.md, creating a good hierarchy: brief overview in README, complete reference in command documentation. The end-to-end workflow (generate → analyze) is clearly described and reinforced across both documents.


- `/must-gather:analyze` - Analyze collected must-gather data
- `oc adm must-gather --help` - For all available options
- OpenShift documentation: https://docs.openshift.com/container-platform/latest/support/gathering-cluster-data.html
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Wrap bare URL in link syntax.

Line 93 contains a bare URL flagged by markdownlint (MD034). Convert it to proper markdown link syntax for consistency and to resolve the linting issue.

- OpenShift documentation: https://docs.openshift.com/container-platform/latest/support/gathering-cluster-data.html
+ OpenShift documentation: [Gathering cluster data](https://docs.openshift.com/container-platform/latest/support/gathering-cluster-data.html)
📝 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
- OpenShift documentation: https://docs.openshift.com/container-platform/latest/support/gathering-cluster-data.html
- OpenShift documentation: [Gathering cluster data](https://docs.openshift.com/container-platform/latest/support/gathering-cluster-data.html)
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

93-93: Bare URL used

(MD034, no-bare-urls)

🤖 Prompt for AI Agents
In plugins/must-gather/commands/generate.md around line 93, there's a bare URL
("https://docs.openshift.com/container-platform/latest/support/gathering-cluster-data.html")
causing markdownlint MD034; replace it with proper Markdown link syntax by
wrapping the URL in square brackets with a descriptive label followed by the URL
in parentheses (e.g., [OpenShift
documentation](https://docs.openshift.com/container-platform/latest/support/gathering-cluster-data.html))
so the link renders and lint passes.

@Meina-rh
Copy link
Author

@bentito PTAL, thanks

## Overview

This plugin provides tools to analyze must-gather data collected from OpenShift clusters, displaying resource status in familiar `oc`-like format and identifying cluster issues.
This plugin provides tools to generate and analyze must-gather data from OpenShift clusters, displaying resource status in familiar `oc`-like format and identifying cluster issues.
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good expand the README a bit to disambiguate with the other must-gather related helpers:
• cluster collection (/must-gather:generate)
• analysis of existing data (/must-gather:analyze)
• CI artifact extraction (/prow-job:extract-must-gather) 

Copy link
Author

Choose a reason for hiding this comment

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

@bentito thanks for reviewing this. I've added some contexts in README.md

@zaneb
Copy link
Contributor

zaneb commented Dec 18, 2025

/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 Dec 18, 2025
Signed-off-by: Meina-rh <meinli@redhat.com>
@Meina-rh Meina-rh force-pushed the generate_mustgather branch from 1c08a25 to 4cef15a Compare December 19, 2025 08:11
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
plugins/must-gather/commands/generate.md (1)

89-93: Wrap bare URL in markdown link syntax (MD034 violation).

Line 93 contains a bare URL, which violates markdownlint's MD034 rule. Wrap it in markdown link syntax with a descriptive label.

🔎 Proposed fix
  ## See Also
  
  - `/must-gather:analyze` - Analyze collected must-gather data
  - `oc adm must-gather --help` - For all available options
- - OpenShift documentation: https://docs.openshift.com/container-platform/latest/support/gathering-cluster-data.html
+ - [OpenShift documentation: Gathering cluster data](https://docs.openshift.com/container-platform/latest/support/gathering-cluster-data.html)
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 1c08a25 and 4cef15a.

📒 Files selected for processing (2)
  • plugins/must-gather/README.md (2 hunks)
  • plugins/must-gather/commands/generate.md (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
plugins/must-gather/commands/generate.md

10-10: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


56-56: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


62-62: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


67-67: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


72-72: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


77-77: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


93-93: Bare URL used

(MD034, no-bare-urls)

plugins/must-gather/README.md

262-262: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (4)
plugins/must-gather/README.md (2)

1-11: Good! Overview improvements directly address disambiguation feedback.

The expanded overview clearly separates the three distinct must-gather-related workflows (generation, analysis, and CI extraction), which addresses the prior feedback to disambiguate between capabilities. This helps users understand exactly what this plugin does.


287-303: LGTM!

The /must-gather:analyze documentation is clear and includes helpful examples of both basic and component-specific analysis.

plugins/must-gather/commands/generate.md (2)

21-46: LGTM!

The implementation section provides a clear, step-by-step procedural guide that covers all necessary prerequisites, image selection logic, and post-collection workflows. The inclusion of the optional analysis step aligns well with the end-to-end generate + analyze workflow described in the PR.


48-80: LGTM!

The return values are clearly documented, and the five examples comprehensively cover common usage patterns. Example 5 particularly stands out for demonstrating the generate-then-analyze workflow, which aligns with the PR's goal of providing end-to-end must-gather functionality.

Comment on lines +10 to +12
```
/must-gather:generate [image] [--dest-dir path]
```
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

find . -name "generate.md" -path "*/must-gather/*" 2>/dev/null | head -20

Repository: openshift-eng/ai-helpers

Length of output: 110


🏁 Script executed:

cat -n ./plugins/must-gather/commands/generate.md

Repository: openshift-eng/ai-helpers

Length of output: 4157


Add language identifier to fenced code blocks (MD040 violations).

The file contains six code blocks lacking language identifiers. All code blocks display shell command examples and should be marked with ```bash. Affected lines: 10, 56, 62, 67, 72, and 77.

  ## Synopsis
- ```
+ ```bash
  /must-gather:generate [image] [--dest-dir path]
  1. Generate must-gather with default image:
  • /must-gather:generate
  1. Generate must-gather with specific image:
  • /must-gather:generate registry.redhat.io/openshift4/ose-must-gather:v4.14
  1. Generate must-gather to specific directory:
  • /must-gather:generate --dest-dir /tmp/my-must-gather
  1. Generate must-gather with custom image (e.g., network diagnostics):
  • /must-gather:generate quay.io/openshift/origin-must-gather:latest
  1. Generate and then analyze:
  • /must-gather:generate

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.18.1)</summary>

10-10: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

In plugins/must-gather/commands/generate.md around lines 10 to 12 (and also
affecting lines 56, 62, 67, 72, 77), several fenced code blocks lack a language
identifier; update each triple-backtick fence that shows shell command examples
to use bash so all six code blocks are marked as bash (e.g., change to

highlighting across the file.

Comment on lines +259 to +286
#### `/must-gather:generate [image] [--dest-dir path]`
Generates must-gather diagnostic data from an OpenShift cluster.

```
# Generate with default image
/must-gather:generate

# Use specific must-gather image
/must-gather:generate registry.redhat.io/openshift4/ose-must-gather:v4.14

# Specify output directory
/must-gather:generate --dest-dir /tmp/my-must-gather
```

Collects diagnostic information including:
- Cluster resource definitions
- Operator logs and status
- Pod logs and events
- Network configuration
- Storage information

Requires:
- `oc` CLI installed and configured
- Active connection to an OpenShift cluster
- Cluster-admin or appropriate permissions

Output is saved to `/tmp/must-gather-<timestamp>/` by default. After collection, you can use `/must-gather:analyze` to analyze the data.

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if the file exists and examine lines 259-286
if [ -f "plugins/must-gather/README.md" ]; then
  wc -l "plugins/must-gather/README.md"
  echo "---"
  sed -n '259,286p' "plugins/must-gather/README.md"
else
  echo "File not found"
fi

Repository: openshift-eng/ai-helpers

Length of output: 920


Add language identifier to code block (MD040 violation).

The fenced code block at line 262 lacks a language identifier, which violates markdownlint's MD040 rule. Change the opening fence from ``` to ```bash to specify bash language for proper syntax highlighting.

  #### `/must-gather:generate [image] [--dest-dir path]`
  Generates must-gather diagnostic data from an OpenShift cluster.
  
- ```
+ ```bash
  # Generate with default image
  /must-gather:generate
  
  # Use specific must-gather image
  /must-gather:generate registry.redhat.io/openshift4/ose-must-gather:v4.14
  
  # Specify output directory
  /must-gather:generate --dest-dir /tmp/my-must-gather

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.18.1)</summary>

262-262: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

In plugins/must-gather/README.md around lines 259 to 286, the fenced code block
starting at line 262 has no language identifier causing an MD040 markdownlint
violation; update the opening fence to include a language (e.g., bash) so the
block becomes ```bash and keep the existing content and closing fence unchanged
to enable proper syntax highlighting.


</details>

<!-- fingerprinting:phantom:triton:mongoose -->

<!-- This is an auto-generated comment by CodeRabbit -->

@Meina-rh
Copy link
Author

/test lint

@openshift-ci
Copy link

openshift-ci bot commented Dec 19, 2025

@Meina-rh: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

/test images

Use /test all to run all jobs.

Details

In response to this:

/test lint

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.

Copy link
Contributor

@bentito bentito left a comment

Choose a reason for hiding this comment

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

Re-reviewing the changes. /lgtm

@bentito
Copy link
Contributor

bentito commented Feb 6, 2026

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 6, 2026
@openshift-ci
Copy link

openshift-ci bot commented Feb 6, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bentito, Meina-rh

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 Feb 6, 2026
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants