Debian Codegraph @

.claude/skills/azp-logs/SKILL.md

raw
1 ---
2 name: azp-logs
3 description: Download Azure Pipelines CI logs for analysis
4 argument-hint: <pr_number|build_id|build_url>
5 allowed-tools: [Bash(gh pr view:*), Bash(gh pr checks:*), Bash(ls:*), Read, Grep]
6 user-invocable: true
7 ---
8
9 Azure Pipelines Logs Downloader
10 ================================
11
12 Download Azure Pipelines CI logs for analyzing test failures and CI issues.
13
14 **IMPORTANT**: Always ask the user before downloading logs. The download may take 5-10 minutes (or longer for large CI runs)
15 depending on the number of jobs and log size.
16
17 Usage
18 -----
19
20 ```bash
21 /azp-logs <pr_number|build_id|build_url>
22 ```
23
24 Arguments
25 ---------
26
27 - `pr_number`: GitHub PR number (will extract build ID from latest CI run)
28 - `build_id`: Azure Pipelines build ID (numeric)
29 - `build_url`: Full Azure Pipelines URL (e.g., <https://dev.azure.com/ansible/ansible/_build/results?buildId=12345>)
30
31 Implementation
32 --------------
33
34 This command uses the existing `hacking/azp/download.py` script to download CI logs.
35
36 **Before running**: Always confirm with the user before downloading logs. Inform them that:
37
38 - The download may take 5-10 minutes for a full CI run (potentially longer for very large runs)
39 - Logs will be saved to a directory named after the build ID
40 - The download size can be 10-50MB depending on the number of jobs
41
42 Process Steps
43 -------------
44
45 1. **Ask user for confirmation**: Explain what will be downloaded and estimated time
46
47 2. **Determine build ID**:
48 - If given a PR number: Use `gh pr checks <number>` to get the Azure Pipelines URL
49 - If given a URL: Pass it directly to download.py (it extracts buildId automatically)
50 - If given a build ID: Use directly
51
52 3. **Download logs**: Run `hacking/azp/download.py` with appropriate flags:
53
54 ```bash
55 ./hacking/azp/download.py <build_id_or_url> --console-logs -v
56 ```
57
58 4. **Analyze logs**: After download completes, examine logs in `<build_id>/` directory:
59 - Grep for common failure patterns: `FAILED`, `ERROR`, `Traceback`
60 - Focus on logs from failed jobs (check job names)
61 - Compare with ansibot comments for context
62
63 Download Script Options
64 -----------------------
65
66 The `hacking/azp/download.py` script supports:
67
68 - `--console-logs`: Download console logs (recommended for CI failure analysis)
69 - `--artifacts`: Download test artifacts
70 - `--run-metadata`: Download run metadata JSON
71 - `--all`: Download everything
72 - `--match-job-name <regex>`: Filter to specific jobs
73 - `--match-artifact-name <regex>`: Filter to specific artifacts
74 - `-v, --verbose`: Show what is being downloaded
75 - `-t, --test`: Dry run (show what would be downloaded)
76
77 For most CI failure analysis, use `--console-logs` to get the log files.
78
79 Common Analysis Patterns
80 ------------------------
81
82 After downloading logs to `<build_id>/` directory:
83
84 ```bash
85 # Find all errors and failures
86 grep -r "FAILED\|ERROR\|Traceback" <build_id>/
87
88 # Find specific test failures
89 grep -r "FAILED test" <build_id>/
90
91 # Find sanity test failures
92 grep -r "The test" <build_id>/ | grep -i "failed"
93
94 # List all downloaded log files
95 ls -lh <build_id>/
96 ```
97
98 Notes
99 -----
100
101 - Logs are downloaded to a directory named after the build ID
102 - Console logs are named after the job hierarchy (e.g., "Job Name Stage Name.log")
103 - The Ansible project is public, so no authentication is required