Skip to content

Commit d432fad

Browse files
committed
document PowerShell requirements for build analysis script
Add PowerShell installation instructions and version requirements: - Minimum: PowerShell 5.1 (Windows built-in) - Recommended: PowerShell 7+ (cross-platform) - Always prefer pwsh over powershell.exe when available Add runtime version check to script with helpful error messages. 🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
1 parent e30b70f commit d432fad

4 files changed

Lines changed: 91 additions & 3 deletions

File tree

.claude/skills/troubleshoot-ci-build/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,48 @@ Ask for details on a specific failure to get:
115115

116116
## Requirements
117117

118+
- **PowerShell** - [Installation instructions](#installing-powershell)
119+
- **Recommended**: PowerShell 7+ (`pwsh`) - cross-platform, modern features
120+
- **Minimum**: PowerShell 5.1 (`powershell.exe` on Windows only)
118121
- **GitHub CLI** (`gh`) authenticated (for PR analysis)
119122
- **Azure CLI** (`az`) authenticated to DataDog organization
120123
- **Internet connection** to fetch build data
121124

125+
### Installing PowerShell
126+
127+
**Recommended**: Install PowerShell 7+ for the best experience and cross-platform support.
128+
129+
**Windows**:
130+
```powershell
131+
winget install Microsoft.PowerShell
132+
```
133+
134+
**macOS**:
135+
```bash
136+
brew install powershell/tap/powershell
137+
```
138+
139+
**Linux (Ubuntu/Debian)**:
140+
```bash
141+
# Download the Microsoft repository GPG keys
142+
wget -q https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb
143+
144+
# Register the Microsoft repository GPG keys
145+
sudo dpkg -i packages-microsoft-prod.deb
146+
147+
# Update apt and install PowerShell
148+
sudo apt-get update
149+
sudo apt-get install -y powershell
150+
```
151+
152+
**Linux (Other distributions)** and more details: https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell
153+
154+
**Verify installation**:
155+
```bash
156+
pwsh -Version
157+
# Should output: PowerShell 7.x.x or higher
158+
```
159+
122160
## Related Scripts (tracer/tools/)
123161

124162
This skill uses the following standalone scripts that can also be run manually:

.claude/skills/troubleshoot-ci-build/SKILL.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,35 @@ allowed-tools: WebFetch, Bash(gh pr checks:*), Bash(az devops invoke:*), Bash(az
1111

1212
Troubleshoot Azure DevOps pipeline failures with automated analysis and comparison against master builds.
1313

14+
## Prerequisites
15+
16+
**CRITICAL**: This skill requires PowerShell to run the build analysis script.
17+
18+
**PowerShell version requirements**:
19+
- **Recommended**: PowerShell 7+ (`pwsh`) - cross-platform, modern features
20+
- **Minimum**: PowerShell 5.1 (`powershell.exe` on Windows only)
21+
22+
**Installation**:
23+
- Windows: `winget install Microsoft.PowerShell` (or use built-in PowerShell 5.1)
24+
- macOS: `brew install powershell/tap/powershell`
25+
- Linux: https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-linux
26+
27+
**If the user does not have PowerShell installed**:
28+
1. Check for `pwsh` first: `pwsh -Version`
29+
2. If not found and on Windows, check for PowerShell 5.1: `powershell -NoProfile -Command '$PSVersionTable.PSVersion'`
30+
3. If neither found or version is too old, provide installation instructions from [README.md](README.md#installing-powershell)
31+
4. Do NOT attempt to replicate the script functionality using bash/jq - the logic is too complex
32+
33+
**Always prefer `pwsh` over `powershell.exe`** when both are available (better cross-platform compatibility and modern features).
34+
35+
**Other requirements**:
36+
- GitHub CLI (`gh`) authenticated (for PR analysis)
37+
- Azure CLI (`az`) configured
38+
1439
## Additional Resources
1540

1641
- **[failure-patterns.md](failure-patterns.md)** - Reference guide with known CI failure patterns, categorization rules, and decision trees. Load when you need to categorize a failure type or compare against historical patterns.
17-
- **[README.md](README.md)** - User-facing documentation with usage examples. Reference when explaining skill capabilities to users.
42+
- **[README.md](README.md)** - User-facing documentation with usage examples and installation instructions. Reference when explaining skill capabilities to users.
1843
- **[scripts-reference.md](scripts-reference.md)** - Documentation for `Get-AzureDevOpsBuildAnalysis.ps1` script (parameters, usage, output structure).
1944

2045
## Task

.claude/skills/troubleshoot-ci-build/scripts-reference.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,15 @@ This document describes reusable PowerShell scripts for Azure DevOps CI troubles
1212

1313
### Prerequisites
1414

15-
- Azure CLI (`az`) authenticated to DataDog organization
16-
- GitHub CLI (`gh`) authenticated (only if using `-PullRequest` parameter)
15+
- **PowerShell 5.1+** - Required to run this script
16+
- **Recommended**: PowerShell 7+ (`pwsh`) for cross-platform support
17+
- **Minimum**: PowerShell 5.1 (`powershell.exe` on Windows)
18+
- Installation: https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell
19+
- Verify: `pwsh -Version` or `powershell -NoProfile -Command '$PSVersionTable.PSVersion'`
20+
- **Azure CLI** (`az`) authenticated to DataDog organization
21+
- **GitHub CLI** (`gh`) authenticated (only if using `-PullRequest` parameter)
22+
23+
**Note**: This script uses PowerShell-specific features (e.g., `-notin` operator, `HashSet<T>`, `Invoke-RestMethod`) that cannot be easily replicated in bash. Always prefer `pwsh` over `powershell.exe` when both are available.
1724

1825
### Parameters
1926

tracer/tools/Get-AzureDevOpsBuildAnalysis.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,24 @@ param(
8686

8787
$ErrorActionPreference = 'Stop'
8888

89+
# Verify PowerShell version (requires 5.1+ for ConvertTo-Json -Depth and -notin operator)
90+
if ($PSVersionTable.PSVersion.Major -lt 5 -or
91+
($PSVersionTable.PSVersion.Major -eq 5 -and $PSVersionTable.PSVersion.Minor -lt 1)) {
92+
Write-Error @"
93+
This script requires PowerShell 5.1 or higher.
94+
Current version: $($PSVersionTable.PSVersion)
95+
96+
Install PowerShell 7+ (recommended for cross-platform support):
97+
- Windows: winget install Microsoft.PowerShell
98+
- macOS: brew install powershell/tap/powershell
99+
- Linux: https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-linux
100+
101+
Or use PowerShell 5.1 (Windows only):
102+
- Included with Windows 10/11 - run with: powershell.exe (not powershell.exe -Version 2)
103+
"@
104+
exit 1
105+
}
106+
89107
#region Helper Functions
90108

91109
function Invoke-AzDevOpsApi {

0 commit comments

Comments
 (0)