Template Composition
Documentation menu
The Azure Pipelines templates compose through repository resources and template inputs. The goal is the same as dependency injection: small parts with explicit contracts.
Explicit contracts
A template should declare its parameters. Consumers should pass values rather than rely on variables that happen to exist in the environment. That makes a pipeline readable from the YAML alone.
Composition
resources:
repositories:
- repository: templates
type: git
name: your-project/templates
ref: refs/tags/v1
stages:
- template: templates/package.yml@templates
parameters:
project: src/Example/Example.csproj
Changing the contract
When a template gains a required input, treat that as a breaking change. Tag the template repository and give consumers a migration window. The same versioning discipline that applies to packages applies to pipeline templates.