Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ MANDATORY: Always check the `VS Code - Build` watch task output via #runTasks/ge
- Monitor the `VS Code - Build` task outputs for real-time compilation errors as you make changes
- This task runs `Core - Build` and `Ext - Build` to incrementally compile VS Code TypeScript sources and built-in extensions
- Start the task if it's not already running in the background
- For TypeScript changes in the `build` folder, you can simply run `npm run typecheck` in the `build` folder.

### TypeScript validation steps
- Use the run test tool if you need to run tests. If that tool is not available, then you can use `scripts/test.sh` (or `scripts\test.bat` on Windows) for unit tests (add `--grep <pattern>` to filter tests) or `scripts/test-integration.sh` (or `scripts\test-integration.bat` on Windows) for integration tests (integration tests end with .integrationTest.ts or are in /extensions/).
Expand Down
144 changes: 112 additions & 32 deletions .github/skills/azure-pipelines/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,24 @@ Use the [queue command](./azure-pipeline.ts) to queue a validation build:

```bash
# Queue a build on the current branch
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts queue
node .github/skills/azure-pipelines/azure-pipeline.ts queue

# Queue with a specific source branch
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts queue --branch my-feature-branch
node .github/skills/azure-pipelines/azure-pipeline.ts queue --branch my-feature-branch

# Queue with custom variables (e.g., to skip certain stages)
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts queue --variables "SKIP_TESTS=true"
# Queue with custom parameters
node .github/skills/azure-pipelines/azure-pipeline.ts queue --parameter "VSCODE_BUILD_WEB=false" --parameter "VSCODE_PUBLISH=false"

# Parameter value with spaces
node .github/skills/azure-pipelines/azure-pipeline.ts queue --parameter "VSCODE_BUILD_TYPE=Product Build"
```

> **Important**: Before queueing a new build, cancel any previous builds on the same branch that you no longer need. This frees up build agents and reduces resource waste:
> ```bash
> # Find the build ID from status, then cancel it
> node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts status
> node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts cancel --build-id <id>
> node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts queue
> node .github/skills/azure-pipelines/azure-pipeline.ts status
> node .github/skills/azure-pipelines/azure-pipeline.ts cancel --build-id <id>
> node .github/skills/azure-pipelines/azure-pipeline.ts queue
> ```

### Script Options
Expand All @@ -89,27 +92,61 @@ node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts
|--------|-------------|
| `--branch <name>` | Source branch to build (default: current git branch) |
| `--definition <id>` | Pipeline definition ID (default: 111) |
| `--variables <vars>` | Pipeline variables in `KEY=value` format, space-separated |
| `--parameter <entry>` | Pipeline parameter in `KEY=value` format (repeatable) |
| `--parameters <list>` | Space-separated parameters in `KEY=value KEY2=value2` format |
| `--dry-run` | Print the command without executing |

### Product Build Queue Parameters (`build/azure-pipelines/product-build.yml`)

| Name | Type | Default | Allowed Values | Description |
|------|------|---------|----------------|-------------|
| `VSCODE_QUALITY` | string | `insider` | `exploration`, `insider`, `stable` | Build quality channel |
| `VSCODE_BUILD_TYPE` | string | `Product Build` | `Product`, `CI` | Build mode for Product vs CI |
| `NPM_REGISTRY` | string | `https://pkgs.dev.azure.com/monacotools/Monaco/_packaging/vscode/npm/registry/` | any URL | Custom npm registry |
| `CARGO_REGISTRY` | string | `sparse+https://pkgs.dev.azure.com/monacotools/Monaco/_packaging/vscode/Cargo/index/` | any URL | Custom Cargo registry |
| `VSCODE_BUILD_WIN32` | boolean | `true` | `true`, `false` | Build Windows x64 |
| `VSCODE_BUILD_WIN32_ARM64` | boolean | `true` | `true`, `false` | Build Windows arm64 |
| `VSCODE_BUILD_LINUX` | boolean | `true` | `true`, `false` | Build Linux x64 |
| `VSCODE_BUILD_LINUX_SNAP` | boolean | `true` | `true`, `false` | Build Linux x64 Snap |
| `VSCODE_BUILD_LINUX_ARM64` | boolean | `true` | `true`, `false` | Build Linux arm64 |
| `VSCODE_BUILD_LINUX_ARMHF` | boolean | `true` | `true`, `false` | Build Linux armhf |
| `VSCODE_BUILD_ALPINE` | boolean | `true` | `true`, `false` | Build Alpine x64 |
| `VSCODE_BUILD_ALPINE_ARM64` | boolean | `true` | `true`, `false` | Build Alpine arm64 |
| `VSCODE_BUILD_MACOS` | boolean | `true` | `true`, `false` | Build macOS x64 |
| `VSCODE_BUILD_MACOS_ARM64` | boolean | `true` | `true`, `false` | Build macOS arm64 |
| `VSCODE_BUILD_MACOS_UNIVERSAL` | boolean | `true` | `true`, `false` | Build macOS universal (requires both macOS arches) |
| `VSCODE_BUILD_WEB` | boolean | `true` | `true`, `false` | Build Web artifacts |
| `VSCODE_PUBLISH` | boolean | `true` | `true`, `false` | Publish to builds.code.visualstudio.com |
| `VSCODE_RELEASE` | boolean | `false` | `true`, `false` | Trigger release flow if successful |
| `VSCODE_STEP_ON_IT` | boolean | `false` | `true`, `false` | Skip tests |

Example: run a quick CI-oriented validation with minimal publish/release side effects:

```bash
node .github/skills/azure-pipelines/azure-pipeline.ts queue \
--parameter "VSCODE_BUILD_TYPE=CI Build" \
--parameter "VSCODE_PUBLISH=false" \
--parameter "VSCODE_RELEASE=false"
```

---

## Checking Build Status

Use the [status command](./azure-pipeline.ts) to monitor a running build:

```bash
# Get status of the most recent build on your branch
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts status
# Get status of the most recent builds
node .github/skills/azure-pipelines/azure-pipeline.ts status

# Get overview of a specific build by ID
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts status --build-id 123456
node .github/skills/azure-pipelines/azure-pipeline.ts status --build-id 123456

# Watch build status (refreshes every 30 seconds)
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts status --watch
node .github/skills/azure-pipelines/azure-pipeline.ts status --watch

# Watch with custom interval (60 seconds)
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts status --watch 60
node .github/skills/azure-pipelines/azure-pipeline.ts status --watch 60
```

### Script Options
Expand All @@ -133,10 +170,10 @@ Use the [cancel command](./azure-pipeline.ts) to stop a running build:

```bash
# Cancel a build by ID (use status command to find IDs)
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts cancel --build-id 123456
node .github/skills/azure-pipelines/azure-pipeline.ts cancel --build-id 123456

# Dry run (show what would be cancelled)
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts cancel --build-id 123456 --dry-run
node .github/skills/azure-pipelines/azure-pipeline.ts cancel --build-id 123456 --dry-run
```

### Script Options
Expand All @@ -149,6 +186,44 @@ node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts

---

## Testing Pipeline Changes

When the user asks to **test changes in an Azure Pipelines build**, follow this workflow:

1. **Queue a new build** on the current branch
2. **Poll for completion** by periodically checking the build status until it finishes

### Polling for Build Completion

Use a shell loop with `sleep` to poll the build status. The `sleep` command works on all major operating systems:

```bash
# Queue the build and note the build ID from output (e.g., 123456)
node .github/skills/azure-pipelines/azure-pipeline.ts queue

# Poll every 60 seconds until complete (works on macOS, Linux, and Windows with Git Bash/WSL)
# Replace <BUILD_ID> with the actual build ID from the queue command
while true; do
node .github/skills/azure-pipelines/azure-pipeline.ts status --build-id <BUILD_ID> --json 2>/dev/null | grep -q '"status": "completed"' && break
sleep 60
done

# Check final result
node .github/skills/azure-pipelines/azure-pipeline.ts status --build-id <BUILD_ID>
```

Alternatively, use the built-in `--watch` flag which handles polling automatically:

```bash
node .github/skills/azure-pipelines/azure-pipeline.ts queue
# Use the build ID returned by the queue command
node .github/skills/azure-pipelines/azure-pipeline.ts status --build-id <BUILD_ID> --watch
```

> **Note**: The `--watch` flag polls every 30 seconds by default. Use `--watch 60` for a 60-second interval to reduce API calls.

---

## Common Workflows

### 1. Quick Pipeline Validation
Expand All @@ -159,45 +234,50 @@ git add -A && git commit -m "test: pipeline changes"
git push origin HEAD

# Check for any previous builds on this branch and cancel if needed
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts status
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts cancel --build-id <id> # if there's an active build
node .github/skills/azure-pipelines/azure-pipeline.ts status
node .github/skills/azure-pipelines/azure-pipeline.ts cancel --build-id <id> # if there's an active build

# Queue and watch the new build
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts queue
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts status --watch
node .github/skills/azure-pipelines/azure-pipeline.ts queue
node .github/skills/azure-pipelines/azure-pipeline.ts status --watch
```

### 2. Investigate a Build

```bash
# Get overview of a build (shows stages, artifacts, and log IDs)
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts status --build-id 123456
node .github/skills/azure-pipelines/azure-pipeline.ts status --build-id 123456

# Download a specific log for deeper inspection
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts status --build-id 123456 --download-log 5
node .github/skills/azure-pipelines/azure-pipeline.ts status --build-id 123456 --download-log 5

# Download an artifact
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts status --build-id 123456 --download-artifact unsigned_vscode_cli_win32_x64_cli
node .github/skills/azure-pipelines/azure-pipeline.ts status --build-id 123456 --download-artifact unsigned_vscode_cli_win32_x64_cli
```

### 3. Test with Modified Variables
### 3. Test with Modified Parameters

```bash
# Skip expensive stages during validation
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts queue --variables "VSCODE_BUILD_SKIP_INTEGRATION_TESTS=true"
# Customize build matrix for quicker validation
node .github/skills/azure-pipelines/azure-pipeline.ts queue \
--parameter "VSCODE_BUILD_TYPE=CI Build" \
--parameter "VSCODE_BUILD_WEB=false" \
--parameter "VSCODE_BUILD_ALPINE=false" \
--parameter "VSCODE_BUILD_ALPINE_ARM64=false" \
--parameter "VSCODE_PUBLISH=false"
```

### 4. Cancel a Running Build

```bash
# First, find the build ID
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts status
node .github/skills/azure-pipelines/azure-pipeline.ts status

# Cancel a specific build by ID
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts cancel --build-id 123456
node .github/skills/azure-pipelines/azure-pipeline.ts cancel --build-id 123456

# Dry run to see what would be cancelled
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts cancel --build-id 123456 --dry-run
node .github/skills/azure-pipelines/azure-pipeline.ts cancel --build-id 123456 --dry-run
```

### 5. Iterate on Pipeline Changes
Expand All @@ -210,12 +290,12 @@ git add -A && git commit --amend --no-edit
git push --force-with-lease origin HEAD

# Find the outdated build ID and cancel it
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts status
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts cancel --build-id <id>
node .github/skills/azure-pipelines/azure-pipeline.ts status
node .github/skills/azure-pipelines/azure-pipeline.ts cancel --build-id <id>

# Queue a fresh build and monitor
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts queue
node --experimental-strip-types .github/skills/azure-pipelines/azure-pipeline.ts status --watch
node .github/skills/azure-pipelines/azure-pipeline.ts queue
node .github/skills/azure-pipelines/azure-pipeline.ts status --watch
```

---
Expand Down
Loading
Loading