agentleFS
MicrosoftKnown publishermicrosoft/azure-pipelines-tasks/.github/copilot-instructions.md

azure-pipelines-tasks

Copilot instructions3.7k starsChanged 9 months agoMITView on GitHub

This repository contains the in-the-box tasks for Azure Pipelines and Team Foundation Server. These instructions will help you understand how to build, test, and deploy tasks effectively. This repo provides open examples of how Azure Pipelines tasks are written and can help you write custom tasks for upload to your account or server. Tasks are tool runners that know how to execute tools like MSBuild, VSTest, etc., handle return codes, process stdout/stderr, write timeline records, and access credentials for Azure…

  • Reads credentials
  • Installs packages

Trending

Quiet this year.thin dataabout the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the microsoft/azure-pipelines-tasks repository that our weekly crawl found: only 8 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

Who's talking about microsoft/azure-pipelines-tasks

The biggest 5 of 8 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 8

Talked about on GitHub and Hacker News (8 times).

On GitHub · 7

2 more on GitHub

On Hacker News · 1

The file

Show its rules and text

We split this copilot-instructions.md into the rules it gives an agent

21 rules. About 0 are common, 13 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Default collections may require old domain format

    line 191
  2. Distinctive:

    After uploading, create a test pipeline:

    line 197
  3. Very specific:

    Update task.json if needed

    line 252
  4. Distinctive:

    Create test pipeline and validate functionality

    line 264
  5. Distinctive:

    Ensure all tests pass

    line 267
  6. Very specific:

    Check in generated files (task.loc.json, strings)

    line 268
  7. Very specific:

    Missing dependencies: Run npm install in repository root

    line 274
  8. Very specific:

    Node version: Ensure Node.js 20+ is installed

    line 275
  9. Very specific:

    TypeScript errors: Check tsconfig.json and update code

    line 276
  10. Distinctive:

    External tool failures: Check network connectivity

    line 277
  11. Distinctive:

    Mock failures: Verify mock data in Tests/ directory

    line 280
  12. Distinctive:

    Tool dependencies: Ensure required tools are available

    line 282
  13. Distinctive:

    Authentication: Verify PAT has correct permissions

    line 285
  14. Distinctive:

    URL format: Use correct collection URL format

    line 286
  15. Distinctive:

    GUID conflicts: Ensure unique GUID for test tasks

    line 287
  16. Distinctive:

    Always test locally: before uploading to Azure DevOps

    line 291
  17. Very specific:

    Update localization files: when changing task.json

    line 295
  18. Distinctive:

    Test cross-platform: if task supports multiple OS

    line 296
  19. Distinctive:

    Update package dependencies to fix versions

    line 308
  20. Very specific:

    Create feature branch: CopilotSkill/CGFix/<WorkItemID>

    line 310
  21. Very specific:

    Create PR with AB#<WorkItemID> for automatic Azure Boards linking

    line 311

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Azure Pipelines Tasks - Copilot Instructions

This repository contains the in-the-box tasks for Azure Pipelines and Team Foundation Server. These instructions will help you understand how to build, test, and deploy tasks effectively.

Repository Overview

This repo provides open examples of how Azure Pipelines tasks are written and can help you write custom tasks for upload to your account or server. Tasks are tool runners that know how to execute tools like MSBuild, VSTest, etc., handle return codes, process stdout/stderr, write timeline records, and access credentials for Azure Pipelines integration.

Prerequisites

Required Tools

  • Node.js: Version 20 or higher is required (minimum 20.17.0)
  • NPM: Version 5.6.0 or higher
  • TypeScript: 4.0.2 or higher (automatically validated during build)
  • .NET SDK: 8.0.100 (automatically downloaded during build if needed)

Verification Commands

node -v && npm -v  # Should show Node 20+ and NPM 5.6+

Initial Setup

# Install repository dependencies (required before building any tasks)
npm install

Building Tasks

Build System Overview

The repository uses a custom build system (make.js) that:

  • Compiles TypeScript to JavaScript
  • Handles task dependencies and external tools
  • Generates localization files (task.loc.json and strings)
  • Validates task definitions
  • Copies resources to the _build directory

Build Commands

Build a Specific Task (Recommended)

# From repository root
node make.js build --task <TaskName>

# Example: Build DotNetCoreCLIV2 task
node make.js build --task DotNetCoreCLIV2

# From task directory
cd Tasks/<TaskName>
npm run build

Build All Tasks (Slow - Can Take 30+ Minutes)

npm run build
# OR
node make.js build

Server Build (For CI Environments)

node make.js serverBuild --task <TaskName>

Build with Bypassed NPM Audit

node make.js build --task <TaskName> --BypassNpmAudit

Debug Build (For Agent Debugging)

node make.js build --task <TaskName> --debug-agent-dir "<path-to-agent-directory>"

Build Output

Built tasks are located in: _build/Tasks/<TaskName>/

The build process creates:

  • Compiled JavaScript files from TypeScript source
  • task.json and task.loc.json (localization metadata)
  • Resource files (PowerShell scripts, icons, etc.)
  • Node modules and dependencies
  • External tools and dependencies

Testing Tasks

Test Types

Unit Tests (L0)

Fast tests that mock external dependencies:

# Test specific task
node make.js test --task <TaskName> --suite L0

# Test all built tasks
npm test
# OR
node make.js test

Integration Tests (L1)

Tests that use real external tools but avoid network calls:

node make.js test --task <TaskName> --suite L1

End-to-End Tests (L2)

Full integration tests with real services:

node make.js test --task <TaskName> --suite L2

Legacy Tests

# All legacy tests
node make.js testLegacy

# Specific task legacy tests
node make.js testLegacy --task <TaskName>

Test Debugging

Set environment variable for additional logging:

export TASK_TEST_TRACE=1
node make.js test --task <TaskName>

End-to-End Testing and Deployment

Prepare Task for E2E Testing

  1. Modify Task GUID (Critical - Prevents Conflicts)
    # Edit both task.json and task.loc.json
    # Change the "id" field to a unique test GUID
    # Use online GUID generator or: uuidgen (macOS/Linux)
  2. Optional: Modify Task Name
    # Edit task.json - change "name" field for easy YAML referencing
    # Example: "DotNetCoreCLI" -> "DotNetCoreCLITest"
  3. Build the Task
    node make.js build --task <TaskName>

Deploy Task to Azure DevOps

Install TFX CLI

# Linux/macOS
sudo npm install -g tfx-cli

# Windows
npm install -g tfx-cli

Create Personal Access Token

  1. Navigate to Azure DevOps → User Settings → Personal Access Tokens
  2. Click "+ New Token"
  3. Name your token
  4. Choose "Custom Defined" → Select "Environment (Read & Write)" OR "Full Access"
  5. Copy and save the token securely

Upload Task

Method 1: Interactive Login

# Login to Azure DevOps
tfx login
# Enter Service URL: https://<YOUR_ORGANISATION>.visualstudio.com/defaultcollection
# Enter your Personal Access Token

# Upload task
tfx build tasks upload --task-path _build/Tasks/<TaskName>

Method 2: One Command Upload

tfx build tasks upload \
  -u https://<YOUR_ORGANISATION>.visualstudio.com/DefaultCollection \
  -t <YOUR_PERSONAL_ACCESS_TOKEN> \
  --task-path _build/Tasks/<TaskName>

Important Notes for Local Azure DevOps Server

  • Default collections may require old domain format
  • Use: https://<YOUR_ORGANISATION>.vsts.me/DefaultCollection
  • Even if your org is on newer domains like codedev.ms

Testing in Azure Pipelines

After uploading, create a test pipeline:

trigger: none

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: YourTestTaskName@1
  inputs:
    # Your task inputs here

Available CLI Commands

node make.js <command> [options]

Commands:
  build          # Build tasks for development
  serverBuild    # Build with full validation (CI)
  buildandtest   # Build and run tests
  test           # Run tests for built tasks
  testLegacy     # Run legacy tests
  clean          # Clean build directories
  package        # Package tasks for distribution
  bump           # Bump task versions
  gendocs        # Generate documentation

Task Structure

Key Files

  • task.json - Task definition and metadata
  • task.loc.json - Localization template (auto-generated)
  • package.json - Node dependencies and build scripts
  • tsconfig.json - TypeScript configuration
  • *.ts - TypeScript source files
  • Tests/ - Test files and test data
  • Strings/ - Localization files

Common Dependencies

  • azure-pipelines-task-lib - Core task library
  • azure-pipelines-tool-lib - Tool installation library
  • Various task-specific common packages

Development Workflow

  1. Setup Environment
    npm install
  2. Make Changes
    • Edit TypeScript source files
    • Update task.json if needed
    • Add/update tests
  3. Build and Test
    node make.js build --task <TaskName>
    node make.js test --task <TaskName> --suite L0
  4. E2E Testing
    • Modify GUID in task.json and task.loc.json
    • Build and upload to test Azure DevOps org
    • Create test pipeline and validate functionality
  5. Submit Changes
    • Ensure all tests pass
    • Check in generated files (task.loc.json, strings)
    • Submit pull request

Troubleshooting

Common Build Issues

  • Missing dependencies: Run npm install in repository root
  • Node version: Ensure Node.js 20+ is installed
  • TypeScript errors: Check tsconfig.json and update code
  • External tool failures: Check network connectivity

Common Test Issues

  • Mock failures: Verify mock data in Tests/ directory
  • Environment variables: Set TASK_TEST_TRACE=1 for debugging
  • Tool dependencies: Ensure required tools are available

Upload Issues

  • Authentication: Verify PAT has correct permissions
  • URL format: Use correct collection URL format
  • GUID conflicts: Ensure unique GUID for test tasks

Best Practices

  1. Always test locally before uploading to Azure DevOps
  2. Use unique GUIDs for test tasks to avoid conflicts
  3. Include comprehensive unit tests (L0 suite)
  4. Follow existing task patterns in the repository
  5. Update localization files when changing task.json
  6. Test cross-platform if task supports multiple OS
  7. Document task inputs/outputs in task.json descriptions

Specialized Workflows

Component Governance (CG) Bug Fixes

For fixing Component Governance security alerts, use the specialized workflow documented in .github/copilot/skills/fix-cg-bug.md.

Quick Reference:

  • Retrieve work item details using Azure CLI or CG API
  • Identify affected tasks via Component Governance API
  • Update package dependencies to fix versions
  • Bump task versions following sprint rules
  • Create feature branch: CopilotSkill/CGFix/<WorkItemID>
  • Create PR with AB#<WorkItemID> for automatic Azure Boards linking

See the skill documentation for the complete 10-step workflow with examples.

Resources

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.