Pipeline templates
What it is
Templates let you factor reusable YAML into separate files and include them from multiple pipelines. In Azure Pipelines there are step/job/stage templates (and extends); in GitHub Actions the equivalent is reusable workflows and composite actions.
Why it exists
Without templates, every pipeline duplicates the same build/test steps, and a one-line change means editing every pipeline. Templates centralize shared logic with parameters, keeping pipelines DRY and consistent.
Key ideas
- Azure Pipelines
template: templates/steps.ymlincludes a step template; parameters (parameters:) pass values.- Job/stage templates reuse whole jobs/stages.
extends: template:(withparameters:) enforces a contract — pipelines must conform to the template’s structure.
- GitHub Actions
- Reusable workflows — call
uses: owner/repo/.github/workflows/wf.yml@refwithwith:/secrets:. - Composite actions — bundle multiple steps into one reusable action.
- Reusable workflows — call
- Templates support parameters with defaults, type checking, and
${{ }}expressions.
Exam notes
- Common exam task: extract repeated steps into a template and include it via
template:. extends:is stricter thantemplate:— it defines the pipeline structure.- GitHub Actions: reusable workflows use
on: workflow_call; secrets must be explicitly passed.
Related
pipeline-yaml · azure-pipelines · jobs-steps · github-actions
📘 Source: Microsoft Learn — Pipeline Templates