Rediģēt

Kopīgot, izmantojot


steps.template definition

Define a set of steps in one file and use it multiple times in another file.

steps:
- template: string # Required as first property. Reference to a template for this step.
  parameters: # Parameters used in a step template.

Definitions that reference this definition: steps

Properties

template string. Required as first property.
Reference to a template for this step.

parameters template parameters.
Parameters used in a step template.

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.