Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"name": "prow-job",
"source": "./plugins/prow-job",
"description": "A plugin to analyze and inspect Prow CI job results",
"version": "0.0.5"
"version": "0.0.6"
},
{
"name": "agendas",
Expand Down
2 changes: 1 addition & 1 deletion docs/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@
"name": "Prow Job Extract Must-Gather"
}
],
"version": "0.0.5"
"version": "0.0.6"
},
{
"commands": [
Expand Down
2 changes: 1 addition & 1 deletion plugins/prow-job/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "prow-job",
"description": "A plugin to analyze and inspect Prow CI job results",
"version": "0.0.5",
"version": "0.0.6",
"author": {
"name": "jupierce"
}
Expand Down
14 changes: 13 additions & 1 deletion plugins/prow-job/commands/analyze-test-failure.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ The command provides comprehensive analysis by:
- Only analyzes test-level artifacts (build-log, intervals)
- Faster results, but may miss cluster-level root causes

**JIRA export (prompted at end)**:
- After analysis completes, you'll be asked if you want to export to JIRA format
- If yes, generates JIRA-formatted output using OCPBUGS template
- Perfect for copy-pasting directly into JIRA OCPBUGS issues

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.

Won't hold up this PR, but you could then just turn around and use the jira plugin/skills to make the OCPBUGS instead of copying into Jira manually

@wangke19 wangke19 Feb 13, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Great idea! We actually discussed this exact enhancement β€” adding a third option like "Yes - File a JIRA using the jira:create command" that would feed the analysis data directly into /jira:create to file the bug automatically. Noted as a follow-up enhancement.

- Uses standard OCPBUGS fields: Description, Version, How reproducible, Steps to Reproduce, Actual results, Expected results, Additional info

### HyperShift Support

For HyperShift jobs with hosted clusters, the command automatically:
Expand All @@ -57,7 +63,11 @@ For HyperShift jobs with hosted clusters, the command automatically:
- Load the "Prow Job Analyze Test Failure" skill
- Proceed with the analysis by following the implementation steps from the skill

The skill handles all the implementation details including URL parsing, artifact downloading, archive extraction, must-gather analysis (if requested), and providing correlated evidence combining test-level and cluster-level insights.
The skill handles all the implementation details including:
- URL parsing and artifact downloading
- Archive extraction and must-gather analysis (if requested)
- Test failure analysis with cluster correlation
- **JIRA export (if requested)**: After analysis completes, user can choose to generate JIRA OCPBUGS-formatted output for direct copy-paste into JIRA issues

## Return Value

Expand All @@ -71,6 +81,8 @@ The skill handles all the implementation details including URL parsing, artifact
- `logs/` - Test artifacts (build-log, interval files)
- `must-gather/logs/` - Cluster diagnostics (if extracted, standard OpenShift)
- `must-gather-mgmt/logs/` and `must-gather-hosted/logs/` - Dual cluster diagnostics (if extracted, HyperShift)
- `analysis.md` - Markdown analysis report (always generated)
- `analysis-jira.txt` - JIRA OCPBUGS-formatted analysis (generated if user chooses to export)

## Arguments:
- $1: Prow job URL (required)
Expand Down
126 changes: 104 additions & 22 deletions plugins/prow-job/skills/prow-job-analyze-test-failure/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ gcloud storage cp gs://test-platform-results/{bucket-path}/build-log.txt .work/p

### Step 4.5: Check for Must-Gather Availability

1. **Check for --fast flag**
1. **Parse optional flags**
- Parse user input for `--fast` flag
- If `--fast` flag present:
- Skip must-gather detection and analysis entirely
Expand Down Expand Up @@ -357,30 +357,35 @@ Only if user chose "Yes" in Step 4.5:

if [ -z "$OUTPUT_DIR" ]; then
echo "ERROR: Could not find output directory in unified dump"
# Skip to Step 5
fi

# Move management cluster data (root level in output/)
# Exclude hostedcluster-* directories
for item in "$OUTPUT_DIR"/*; do
if [ -e "$item" ] && [[ ! "$(basename "$item")" =~ ^hostedcluster- ]]; then
mv "$item" .work/prow-job-analyze-test-failure/{build_id}/must-gather-mgmt/logs/
rm -rf "$TMP_EXTRACT"
# Clear variables to prevent subsequent usage
HAS_HOSTED_CLUSTER="false"
unset HOSTED_DIR
unset OUTPUT_DIR
# Skip to Step 5 - no must-gather analysis possible
else
# Move management cluster data (root level in output/)
# Exclude hostedcluster-* directories
for item in "$OUTPUT_DIR"/*; do
if [ -e "$item" ] && [[ ! "$(basename "$item")" =~ ^hostedcluster- ]]; then
mv "$item" .work/prow-job-analyze-test-failure/{build_id}/must-gather-mgmt/logs/
fi
done

# Move hosted cluster data (hostedcluster-* subdirectory)
if [ "$HAS_HOSTED_CLUSTER" = "true" ]; then

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.

Where is this getting set to true prior to this? I'm missing it.

@wangke19 wangke19 Feb 13, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

HAS_HOSTED_CLUSTER is set earlier in Step 3 (pattern detection), around lines 193-216 of SKILL.md. When the code identifies the archive pattern:

  • Line 193 (Pattern 1 - unified): HAS_HOSTED_CLUSTER=$(tar -tf "$TMP_CHECK" 2>/dev/null | grep -q "hostedcluster-" && echo "true" || echo "false")
  • Line 205 (Pattern 2 - dual): Same tar check on the hypershift-dump archive
  • Lines 211/216 (Pattern 3/none): HAS_HOSTED_CLUSTER=false

So by the time execution reaches this block (Pattern 1 extraction at line 376), the variable was already determined during archive detection. This code block at line 376 is pre-existing from PR #294 β€” this PR only restructured it into an if/else to properly short-circuit when OUTPUT_DIR is missing.

HOSTED_DIR=$(find "$OUTPUT_DIR" -maxdepth 1 -type d -name "hostedcluster-*" | head -1)
if [ -n "$HOSTED_DIR" ]; then
mv "$HOSTED_DIR"/* .work/prow-job-analyze-test-failure/{build_id}/must-gather-hosted/logs/
echo "βœ“ Hosted cluster data extracted from unified archive"
else
echo "WARNING: Expected hosted cluster data but hostedcluster-* directory not found"
fi
fi
done

# Move hosted cluster data (hostedcluster-* subdirectory)
if [ "$HAS_HOSTED_CLUSTER" = "true" ]; then
HOSTED_DIR=$(find "$OUTPUT_DIR" -maxdepth 1 -type d -name "hostedcluster-*" | head -1)
if [ -n "$HOSTED_DIR" ]; then
mv "$HOSTED_DIR"/* .work/prow-job-analyze-test-failure/{build_id}/must-gather-hosted/logs/
echo "βœ“ Hosted cluster data extracted from unified archive"
else
echo "WARNING: Expected hosted cluster data but hostedcluster-* directory not found"
fi
# Cleanup temporary extraction directory
rm -rf "$TMP_EXTRACT"
fi

# Cleanup temporary extraction directory
rm -rf "$TMP_EXTRACT"
```

For Pattern 2 (dual):
Expand Down Expand Up @@ -884,6 +889,83 @@ Synthesize all gathered evidence to determine the most likely root cause for the
- **Hosted cluster must-gather**: `.work/prow-job-analyze-test-failure/{build_id}/must-gather-hosted/logs/`
```

### Step 5.5: Ask User About JIRA Export

After completing the analysis, ask the user if they want to export to JIRA format.

1. **Ask user using AskUserQuestion tool**

```
Question: "Analysis complete! Would you like to export this to JIRA format?"
Header: "JIRA Export"
Options:
- Label: "Yes - Export to JIRA (OCPBUGS format)"
Description: "Generate JIRA-formatted output using OCPBUGS template for easy copy-paste"
- Label: "No - Skip JIRA export"
Description: "Only keep the Markdown analysis file"
```

2. **If user chooses "Yes - Export to JIRA (OCPBUGS format)"**

Generate `.work/prow-job-analyze-test-failure/{build_id}/analysis-jira.txt` using OCPBUGS format:

```
Description of problem:
[Summarize the test failure in 1-2 sentences]

Version-Release number of selected component (if applicable):
[OpenShift version from prowjob, if available]

How reproducible:
[Based on test history - e.g., "Intermittent", "Always", "Sometimes in this job configuration"]

Steps to Reproduce:
1. Run Prow CI job: [job-name]
2. Execute test: [test-name]
3. [Any specific conditions that triggered the failure]

Actual results:
[What actually happened - include error messages, stack traces]
{noformat}
[Stack trace or error output]
{noformat}

Expected results:
[What should have happened - test should pass]

Additional info:
[Include correlation analysis, timeline, affected components]

Job Details:
- Job URL: [prow-job-url]
- Build ID: {{build_id}}
- Test artifacts: {{.work/prow-job-analyze-test-failure/{build_id}/}}

[If must-gather was analyzed, include cluster diagnostics summary]

Root Cause Analysis:
[Detailed analysis from Step 5]
```

3. **Display completion message**

If JIRA export chosen:
```text
βœ… Analysis complete!
πŸ“„ Reports generated:
- Markdown: .work/prow-job-analyze-test-failure/{build_id}/analysis.md
- JIRA (OCPBUGS format): .work/prow-job-analyze-test-failure/{build_id}/analysis-jira.txt

πŸ’‘ Tip: Copy the contents of analysis-jira.txt directly into a JIRA OCPBUGS issue
```

If JIRA export skipped:
```text
βœ… Analysis complete!
πŸ“„ Report generated:
- Markdown: .work/prow-job-analyze-test-failure/{build_id}/analysis.md
```

## Error Handling

Handle errors in the same way as "Error handling" in "Prow Job Analyze Resource" skill, with these additional must-gather-specific cases:
Expand Down