azure-pipelines

作者: microsoft

用于验证VS Code构建的Azure DevOps管道变更。涵盖队列构建、检查构建状态、查看日志以及迭代管道…

npx skills add https://github.com/microsoft/vscode --skill azure-pipelines

Validating Azure Pipeline Changes

When modifying Azure DevOps pipeline files (YAML files in build/azure-pipelines/), you can validate changes locally using the Azure CLI before committing. This avoids the slow feedback loop of pushing changes, waiting for CI, and checking results.

Prerequisites

  1. Check if Azure CLI is installed:

    az --version
    

    If not installed, install it:

    # macOS
    brew install azure-cli
    
    # Windows (PowerShell as Administrator)
    winget install Microsoft.AzureCLI
    
    # Linux (Debian/Ubuntu)
    curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
    
  2. Check if the DevOps extension is installed:

    az extension show --name azure-devops
    

    If not installed, add it:

    az extension add --name azure-devops
    
  3. Authenticate:

    az login
    az devops configure --defaults organization=https://dev.azure.com/monacotools project=Monaco
    

VS Code Main Build

The main VS Code build pipeline:

VS Code Insider Scheduled Builds

Two Insider builds run automatically on a scheduled basis:

  • Morning build: ~7:00 AM CET
  • Evening build: ~7:00 PM CET

These scheduled builds use the same pipeline definition (111) but run on the main branch to produce Insider releases.


Queueing a Build

Use the queue command to queue a validation build:

# Queue a build on the current branch
node .github/skills/azure-pipelines/azure-pipeline.ts queue

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

# 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:

# Find the build ID from status, then cancel it
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

OptionDescription
--branch <name>Source branch to build (default: current git branch)
--definition <id>Pipeline definition ID (default: 111)
--parameter <entry>Pipeline parameter in KEY=value format (repeatable); use this when the value contains spaces
--parameters <list>Space-separated parameters in KEY=value KEY2=value2 format; values must not contain spaces
--dry-runPrint the command without executing

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

NameTypeDefaultAllowed ValuesDescription
VSCODE_QUALITYstringinsiderexploration, insider, stableBuild quality channel
VSCODE_BUILD_TYPEstringProduct BuildProduct, CIBuild mode for Product vs CI
NPM_REGISTRYstringhttps://pkgs.dev.azure.com/monacotools/Monaco/_packaging/vscode/npm/registry/any URLCustom npm registry
CARGO_REGISTRYstringsparse+https://pkgs.dev.azure.com/monacotools/Monaco/_packaging/vscode/Cargo/index/any URLCustom Cargo registry
VSCODE_BUILD_WIN32booleantruetrue, falseBuild Windows x64
VSCODE_BUILD_WIN32_ARM64booleantruetrue, falseBuild Windows arm64
VSCODE_BUILD_LINUXbooleantruetrue, falseBuild Linux x64
VSCODE_BUILD_LINUX_SNAPbooleantruetrue, falseBuild Linux x64 Snap
VSCODE_BUILD_LINUX_ARM64booleantruetrue, falseBuild Linux arm64
VSCODE_BUILD_LINUX_ARMHFbooleantruetrue, falseBuild Linux armhf
VSCODE_BUILD_ALPINEbooleantruetrue, falseBuild Alpine x64
VSCODE_BUILD_ALPINE_ARM64booleantruetrue, falseBuild Alpine arm64
VSCODE_BUILD_MACOSbooleantruetrue, falseBuild macOS x64
VSCODE_BUILD_MACOS_ARM64booleantruetrue, falseBuild macOS arm64
VSCODE_BUILD_MACOS_UNIVERSALbooleantruetrue, falseBuild macOS universal (requires both macOS arches)
VSCODE_BUILD_WEBbooleantruetrue, falseBuild Web artifacts
VSCODE_PUBLISHbooleantruetrue, falsePublish to builds.code.visualstudio.com
VSCODE_RELEASEbooleanfalsetrue, falseTrigger release flow if successful
VSCODE_STEP_ON_ITbooleanfalsetrue, falseSkip tests
VSCODE_USE_LEGACY_OSS_NOTICEbooleanfalsetrue, falseKeep the legacy mixin ThirdPartyNotices.txt instead of the Component Governance notice

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

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 to monitor a running build:

# 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 .github/skills/azure-pipelines/azure-pipeline.ts status --build-id 123456

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

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

Script Options

OptionDescription
--build-id <id>Specific build ID (default: most recent on current branch)
--branch <name>Filter builds by branch name (shows last 20 builds for branch)
--reason <reason>Filter builds by reason: manual, individualCI, batchedCI, schedule, pullRequest
--definition <id>Pipeline definition ID (default: 111)
--watch [seconds]Continuously poll status until build completes (default: 30s)
--download-log <id>Download a specific log to /tmp
--download-artifact <name>Download artifact to /tmp
--jsonOutput raw JSON for programmatic consumption

Cancelling a Build

Use the cancel command to stop a running build:

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

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

Script Options

OptionDescription
--build-id <id>Build ID to cancel (required)
--definition <id>Pipeline definition ID (default: 111)
--dry-runPrint what would be cancelled without executing

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:

# 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:

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

# Make your YAML changes, then:
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 .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 .github/skills/azure-pipelines/azure-pipeline.ts queue
node .github/skills/azure-pipelines/azure-pipeline.ts status --watch

2. Investigate a Build

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

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

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

3. Test with Modified Parameters

# 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

# First, find the build ID
node .github/skills/azure-pipelines/azure-pipeline.ts status

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

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

5. Iterate on Pipeline Changes

When iterating on pipeline YAML changes, always cancel obsolete builds before queueing new ones:

# Push new changes
git add -A && git commit --amend --no-edit
git push --force-with-lease origin HEAD

# Find the outdated build ID and cancel it
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 .github/skills/azure-pipelines/azure-pipeline.ts queue
node .github/skills/azure-pipelines/azure-pipeline.ts status --watch

Troubleshooting

Authentication Issues

# Re-authenticate
az logout
az login

# Check current account
az account show

Extension Not Found

az extension add --name azure-devops --upgrade

Rate Limiting

If you hit rate limits, add delays between API calls or use --watch with a longer interval.

来自 microsoft 的更多技能

oss-growth
microsoft
OSS增长黑客角色
official
microsoft-foundry
microsoft
端到端部署、评估和管理Foundry代理:Docker构建、ACR推送、托管/提示代理创建、容器启动、批量评估、持续评估、提示优化工作流、agent.yaml、从追踪中整理数据集。用途:将代理部署到Foundry、托管代理、创建代理、调用代理、评估代理、运行批量评估、持续评估、持续监控、持续评估状态、优化提示、改进提示、提示优化器、优化代理指令、改进代理...
officialdevelopmentdevops
azure-ai
microsoft
用于Azure AI:搜索、语音、OpenAI、文档智能。支持搜索、向量/混合搜索、语音转文字、文字转语音、转录、OCR。适用场景:AI搜索、查询搜索、向量搜索、混合搜索、语义搜索、语音转文字、文字转语音、转录、OCR、文字转语音。
officialdevelopmentapi
azure-deploy
microsoft
对已准备好的应用程序执行Azure部署,这些程序需包含现有的.azure/deployment-plan.md和基础设施文件。当用户要求创建新应用程序时,请勿使用此技能——应改用azure-prepare。此技能运行azd up、azd deploy、terraform apply和az deployment命令,并内置错误恢复机制。需要来自azure-prepare的.azure/deployment-plan.md以及来自azure-validate的已验证状态。适用场景:"运行azd up"、"运行azd deploy"、"执行部署"...
officialdevopsaws
azure-storage
microsoft
Azure存储服务,包括Blob存储、文件共享、队列存储、表存储和Data Lake。解答关于存储访问层(热、冷、冷、归档)的问题,说明各层的使用场景及对比。提供对象存储、SMB文件共享、异步消息传递、NoSQL键值存储和大数据分析。包含生命周期管理。用途:Blob存储、文件共享、队列存储、表存储、Data Lake、上传文件、下载Blob、存储账户、访问层等。
officialdevelopmentdatabase
azure-diagnostics
microsoft
使用AppLens、Azure Monitor、资源健康和安全分类调试Azure生产问题。适用场景:调试生产问题、排查应用服务、应用服务CPU过高、应用服务部署失败、排查容器应用、排查函数、排查AKS、kubectl无法连接、kube-system/CoreDNS故障、Pod挂起、CrashLoop、节点未就绪、升级失败、分析日志、KQL、洞察、镜像拉取失败、冷启动问题、健康探测失败……
officialdevopsdevelopment
azure-prepare
microsoft
为Azure应用准备部署(基础设施Bicep/Terraform、azure.yaml、Dockerfile)。用于创建/现代化或创建+部署;不用于跨云迁移(使用azure-cloud-migrate)。请勿用于:copilot-sdk应用(使用azure-hosted-copilot-sdk)。适用场景:"创建应用"、"构建Web应用"、"创建API"、"创建无服务器HTTP API"、"创建前端"、"创建后端"、"构建服务"、"现代化应用"、"更新应用"、"添加身份验证"、"添加缓存"、"托管在Azure上"、"创建并...
officialdevelopmentdevops
azure-validate
microsoft
部署前对Azure就绪状态进行验证。对配置、基础设施(Bicep或Terraform)、RBAC角色分配、托管标识权限及先决条件进行深度检查,然后再部署。适用场景:验证我的应用、检查部署就绪状态、运行预检、验证配置、检查是否可部署、验证azure.yaml、验证Bicep、部署前测试、排查部署错误、验证Azure Functions、验证函数应用、验证无服务器...
officialdevopstesting