Skip to content

Latest commit

 

History

History
127 lines (97 loc) · 2.87 KB

steps-template.md

File metadata and controls

127 lines (97 loc) · 2.87 KB
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

steps.template definition

:::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

Properties

:::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

Examples

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 also

See templates for more about working with templates.