$ show microsoft/azure-pipelines-agent
This repository implements the Azure Pipelines Agent, a cross-platform CI/CD agent that executes build, release, and deployment jobs for Azure DevOps and Team Foundation Server. The agent is written in C# on .NET Core and runs on Windows, macOS, and Linux. Its architecture consists of a Listener process that handles agent lifecycle (registration, authentication, message polling) and a Worker process that executes job steps (tasks, scripts, containers). The codebase includes a plugin system for source control (Git, TFVC, SVN), artifact management, pipeline caching, test result publishing, and code coverage. It features a robust configuration system based on knobs, secret masking, telemetry, and extensive logging. The agent communicates with Azure DevOps services via REST APIs and manages credential storage, proxies, and certificates. While the codebase is mature and well-structured, it contains some legacy code paths, platform-specific implementations, and feature flag complexity that reflect its long evolution.
The LLM identified 4 files worth highlighting for reuse:
Provides a composable configuration system where knobs can be read from environment variables, runtime variables, pipeline features, and built-in defaults. The `CompositeKnobSource` and `Knob` classes allow layered resolution with precedence, and `KnobValue` supports typed values. This is a standalone, reusable pattern for any application needing flexible configuration from multiple sources.
Implements secret masking for log output using both legacy regex-based masking and the OSS `Microsoft.Security.Utilities` library. `LoggedSecretMasker` wraps the raw masker with origin tracking and telemetry. The design is self-contained, with clear interfaces (`ILoggedSecretMasker`, `IRawSecretMasker`), and can be reused in any application that needs to redact secrets from text streams.
Provides a robust cross-platform process invoker with support for cancellation, timeout, environment variables, working directory, and input/output streaming. It handles process tree killing on Windows and POSIX signals on Linux/macOS. The class is fully self-contained and can be extracted into any .NET project needing reliable process execution.
Implements a generic retry helper with configurable max retries, exponential backoff (with jitter), cancellation, and an exception filter delegate. It is used throughout the agent for HTTP calls and file operations. The class is small, well-tested, and can be reused in any .NET project to add resilient retry logic.