title | description | ms.date | monikerRange |
---|---|---|---|
steps.template definition |
Define a set of steps in one file and use it multiple times in another file. |
11/20/2024 |
<=azure-pipelines |
:::moniker range="<=azure-pipelines"
Define a set of steps in one file and use it multiple times in another file.
:::moniker-end
:::moniker range="<=azure-pipelines"
steps:
- template: string # Required as first property. Reference to a template for this step.
parameters: # Parameters used in a step template.
:::moniker-end
:::moniker range="<=azure-pipelines"
Definitions that reference this definition: steps
:::moniker-end
:::moniker range="<=azure-pipelines"
template
string. Required as first property.
Reference to a template for this step.
:::moniker-end
:::moniker range="<=azure-pipelines"
parameters
template parameters.
Parameters used in a step template.
:::moniker-end
In the main pipeline:
steps:
- template: string # reference to template
parameters: { string: any } # provided parameters
In the included template:
parameters: { string: any } # expected parameters
steps: [ script | bash | pwsh | powershell | checkout | task | templateReference ]
# File: steps/build.yml
steps:
- script: npm install
- script: npm test
# File: azure-pipelines.yml
jobs:
- job: macOS
pool:
vmImage: macOS-latest
steps:
- template: steps/build.yml # Template reference
- job: Linux
pool:
vmImage: ubuntu-latest
steps:
- template: steps/build.yml # Template reference
- job: Windows
pool:
vmImage: windows-latest
steps:
- template: steps/build.yml # Template reference
- script: sign # Extra step on Windows only
See templates for more about working with templates.