Skip to content

Commit 8a16d85

Browse files
Merge pull request #6351 from ggiguash/release-manager-claude
NO-ISSUE: Release manager helper using Claude skills
2 parents 090e99f + 12b7d04 commit 8a16d85

File tree

7 files changed

+1244
-7
lines changed

7 files changed

+1244
-7
lines changed
Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
---
2+
name: Analyze CI for Pull Requests
3+
argument-hint: [--rebase] [--limit N]
4+
description: Analyze CI for open MicroShift pull requests and produce a summary of failures
5+
allowed-tools: Skill, Bash, Read, Write, Glob, Grep, Agent
6+
---
7+
8+
# analyze-ci-for-pull-requests
9+
10+
## Synopsis
11+
```
12+
/analyze-ci-for-pull-requests [--rebase] [--limit N]
13+
```
14+
15+
## Description
16+
Fetches all open MicroShift pull requests, identifies failed Prow CI jobs for each PR, analyzes each failure using the `openshift-ci-analysis` agent, and produces a text summary report.
17+
18+
This command orchestrates the analysis workflow by:
19+
20+
1. Fetching the list of open PRs and their failed jobs using `.claude/scripts/microshift-prow-jobs-for-pull-requests.sh --mode detail`
21+
2. Filtering to only PRs that have at least one failed job
22+
3. Analyzing each failed job individually using the `openshift-ci-analysis` agent
23+
4. Aggregating results into a summary report saved to `/tmp`
24+
25+
## Arguments
26+
- `--rebase` (optional): Only analyze rebase PRs (titles containing `NO-ISSUE: rebase-release-`)
27+
- `--limit N` (optional): Limit analysis to first N failed jobs total (useful for quick checks, default: all failed jobs)
28+
29+
## Implementation Steps
30+
31+
### Step 1: Fetch Open PRs and Their Job Results
32+
33+
**Goal**: Get the list of open PRs with failed Prow jobs.
34+
35+
**Actions**:
36+
1. Execute `.claude/scripts/microshift-prow-jobs-for-pull-requests.sh --mode detail` to get all open PRs and their job statuses. If `--rebase` was specified, add `--filter "NO-ISSUE: rebase-release-"` to only include rebase PRs
37+
2. Parse the output to identify PRs with failed jobs (lines containing ``)
38+
3. For each failed job, extract:
39+
- PR number and title (from the `=== PR #NNN: ... ===` header lines)
40+
- PR URL (line following the header)
41+
- Job name (first column)
42+
- Job URL (last column, the Prow URL)
43+
4. Apply `--limit N` if specified
44+
45+
**Example Commands**:
46+
```bash
47+
# All open PRs
48+
bash .claude/scripts/microshift-prow-jobs-for-pull-requests.sh --mode detail 2>/dev/null
49+
50+
# Rebase PRs only
51+
bash .claude/scripts/microshift-prow-jobs-for-pull-requests.sh --mode detail --filter "NO-ISSUE: rebase-release-" 2>/dev/null
52+
```
53+
54+
**Expected Output Format**:
55+
```
56+
=== PR #6313: USHIFT-6636: Change test-agent impl to align with greenboot-rs ===
57+
https://github.com/openshift/microshift/pull/6313
58+
59+
JOB STATUS URL
60+
pull-ci-openshift-microshift-main-e2e-aws-tests ✗ https://prow.ci.openshift.org/view/gs/...
61+
pull-ci-openshift-microshift-main-e2e-aws-tests-arm ✗ https://prow.ci.openshift.org/view/gs/...
62+
...
63+
```
64+
65+
**Error Handling**:
66+
- If no open PRs found, report "No open pull requests found" and exit successfully
67+
- If no failed jobs across all PRs, report "All PR jobs are passing" and exit successfully
68+
- If `microshift-prow-jobs-for-pull-requests.sh` fails, report error and exit
69+
70+
### Step 2: Analyze Each Failed Job Using openshift-ci-analysis Agent
71+
72+
**Goal**: Get detailed root cause analysis for each failed job.
73+
74+
**Actions**:
75+
1. For each failed job URL from Step 1:
76+
- Call the `openshift-ci-analysis` agent with the job URL **in parallel**
77+
- Capture the analysis result (failure reason, error summary)
78+
- Store all intermediate analysis files in `/tmp`
79+
80+
2. Progress reporting:
81+
- Show "Analyzing job X/Y: <job-name> (PR #NNN)" for each job
82+
- Use the Agent tool to invoke `openshift-ci-analysis` for each URL
83+
- **Run all job analyses in parallel** to maximize efficiency
84+
85+
**Data Collection**:
86+
For each job analysis, extract:
87+
- Job name
88+
- Job URL
89+
- PR number and title
90+
- Failure type (build failure, test failure, infrastructure issue)
91+
- Primary error/root cause
92+
- Affected test scenarios (if applicable)
93+
94+
**File Storage**:
95+
All intermediate analysis files are stored in `/tmp` with naming pattern:
96+
- `/tmp/analyze-ci-prs-job-<N>-pr<PR>-<job-name-suffix>.txt`
97+
98+
### Step 3: Aggregate Results and Identify Patterns
99+
100+
**Goal**: Find common failure patterns across all PRs and jobs.
101+
102+
**Actions**:
103+
1. Collect results from all parallel job analyses
104+
- Read individual job analysis files from `/tmp`
105+
- Extract key findings from each analysis
106+
107+
2. Group failures by PR:
108+
- List each PR with its failed jobs and root causes
109+
110+
3. Identify common errors across PRs:
111+
- Count occurrences of similar error messages
112+
- Group jobs with identical root causes (e.g., same infrastructure issue affecting multiple PRs)
113+
114+
### Step 4: Generate Summary Report
115+
116+
**Goal**: Present actionable summary to the user.
117+
118+
**Actions**:
119+
1. Aggregate all job analysis results from parallel execution
120+
2. Identify common patterns and group by PR and failure type
121+
3. Generate summary report and save to `/tmp/analyze-ci-prs-summary.<timestamp>.txt`
122+
4. Display the summary to the user
123+
124+
**Report Structure**:
125+
126+
```
127+
═══════════════════════════════════════════════════════════════
128+
MICROSHIFT OPEN PULL REQUESTS - FAILED JOBS ANALYSIS
129+
═══════════════════════════════════════════════════════════════
130+
131+
OVERVIEW
132+
Total Open PRs: 6
133+
PRs with Failures: 2
134+
Total Failed Jobs: 9
135+
Analysis Date: 2026-03-15
136+
Report: /tmp/analyze-ci-prs-summary.20260315-143022.txt
137+
138+
PER-PR BREAKDOWN
139+
140+
PR #6313: USHIFT-6636: Change test-agent impl to align with greenboot-rs
141+
https://github.com/openshift/microshift/pull/6313
142+
Jobs: 8 passed, 7 failed
143+
144+
Failed Jobs:
145+
1. pull-ci-openshift-microshift-main-e2e-aws-tests
146+
Status: FAILURE
147+
Root Cause: [summarized from openshift-ci-analysis]
148+
URL: https://prow.ci.openshift.org/view/gs/...
149+
150+
2. pull-ci-openshift-microshift-main-e2e-aws-tests-arm
151+
Status: FAILURE
152+
Root Cause: [summarized]
153+
URL: https://prow.ci.openshift.org/view/gs/...
154+
155+
... (more failed jobs)
156+
157+
PR #6116: USHIFT-6491: Improve gitops test
158+
https://github.com/openshift/microshift/pull/6116
159+
Jobs: 15 passed, 2 failed
160+
161+
Failed Jobs:
162+
1. pull-ci-openshift-microshift-main-e2e-aws-tests-bootc-periodic
163+
Status: FAILURE
164+
Root Cause: [summarized]
165+
URL: https://prow.ci.openshift.org/view/gs/...
166+
167+
COMMON PATTERNS (across PRs)
168+
If the same failure pattern appears in multiple PRs, list it here
169+
with the affected PRs and jobs.
170+
171+
═══════════════════════════════════════════════════════════════
172+
173+
Individual job reports: /tmp/analyze-ci-prs-job-*.txt
174+
```
175+
176+
## Examples
177+
178+
### Example 1: Analyze All Failed PR Jobs
179+
180+
```
181+
/analyze-ci-for-pull-requests
182+
```
183+
184+
**Behavior**:
185+
- Fetches all open PRs and their Prow job results
186+
- Identifies PRs with failed jobs
187+
- Analyzes each failed job
188+
- Presents aggregated summary grouped by PR
189+
190+
### Example 2: Analyze Only Rebase PRs
191+
192+
```
193+
/analyze-ci-for-pull-requests --rebase
194+
```
195+
196+
**Behavior**:
197+
- Only includes PRs with `NO-ISSUE: rebase-release-` in the title
198+
- Useful for release manager workflow to check rebase CI status
199+
200+
### Example 3: Quick Analysis (First 5 Failed Jobs)
201+
202+
```
203+
/analyze-ci-for-pull-requests --limit 5
204+
```
205+
206+
**Behavior**:
207+
- Analyzes only first 5 failed jobs across all PRs
208+
- Useful for quick health check
209+
210+
## Performance Considerations
211+
212+
- **Execution Time**: Depends on number of failed jobs; parallel execution helps significantly
213+
- **Network Usage**: Each job analysis fetches logs from GCS
214+
- **Parallelization**: All job analyses run in parallel for maximum efficiency
215+
- **Use --limit**: For quick checks, use --limit flag to analyze a subset
216+
- **File Storage**: All intermediate and report files are stored in `/tmp` directory
217+
218+
## Prerequisites
219+
220+
- `.claude/scripts/microshift-prow-jobs-for-pull-requests.sh` script must exist and be executable
221+
- `openshift-ci-analysis` agent must be available
222+
- `gh` CLI must be authenticated with access to openshift/microshift
223+
- Internet access to fetch job data from GCS
224+
- Bash shell
225+
226+
## Error Handling
227+
228+
### No Open PRs
229+
```
230+
No open pull requests found.
231+
```
232+
233+
### No Failed Jobs
234+
```
235+
All open PR jobs are passing! ✓
236+
No failures to analyze.
237+
```
238+
239+
### Script Not Found
240+
```
241+
Error: Could not find .claude/scripts/microshift-prow-jobs-for-pull-requests.sh
242+
Please ensure you're in the microshift project directory.
243+
```
244+
245+
## Related Skills
246+
247+
- **openshift-ci-analysis**: Detailed analysis of a single job (used internally)
248+
- **analyze-ci-for-release**: Similar analysis for periodic release jobs
249+
- **analyze-ci-for-release-manager**: Multi-release analysis with HTML output
250+
- **analyze-ci-test-scenario**: Analyze specific test scenario results
251+
252+
## Notes
253+
254+
- This skill focuses on **presubmit** PR jobs (not periodic/postsubmit)
255+
- Analysis is read-only - no modifications to CI data or PRs
256+
- Results are saved in files in /tmp directory with a timestamp
257+
- Provide links to the jobs in the summary
258+
- Only present a concise analysis summary for each job
259+
- PRs with no Prow jobs (e.g., drafts without triggered tests) are skipped
260+
- Pattern detection improves with more jobs analyzed (avoid limiting unless needed)

0 commit comments

Comments
 (0)