title | description | ms.date | monikerRange |
---|---|---|---|
extends definition |
Extends a pipeline using a template. |
10/04/2024 |
>=azure-pipelines-2020 |
:::moniker range=">=azure-pipelines-2020"
Extend a pipeline using a template.
:::moniker-end
:::moniker range=">=azure-pipelines-2020"
extends:
template: string # The template referenced by the pipeline to extend.
parameters: # Parameters used in the extend.
:::moniker-end
:::moniker range=">=azure-pipelines-2020"
Definitions that reference this definition: pipeline
:::moniker-end
:::moniker range=">=azure-pipelines-2020"
template
string.
The template referenced by the pipeline to extend.
:::moniker-end
:::moniker range=">=azure-pipelines-2020"
parameters
template parameters.
Parameters used in the extend.
:::moniker-end
Templates and their parameters are turned into constants before the pipeline runs. Template parameters provide type safety to input parameters. In this example, templates restrict which pools can be used in a pipeline by offering an enumeration of possible options rather than a freeform string.
# template.yml
parameters:
- name: userpool
type: string
default: Azure Pipelines
values:
- Azure Pipelines
- private-pool-1
- private-pool-2
pool: ${{ parameters.userpool }}
steps:
- script: # ... removed for clarity
# azure-pipelines.yml
extends:
template: template.yml
parameters:
userpool: private-pool-1