steps.template 定義

1 つのファイルに一連のステップを定義し、別のファイルで複数回使用します。

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

この定義を参照する定義: ステップ

プロパティ

template 文字列。 最初のプロパティとして必須。
この手順のテンプレートへの参照。

parameters テンプレート パラメーター。
ステップ テンプレートで使用されるパラメーター。

メイン パイプラインで:

steps:
- template: string  # reference to template
  parameters: { string: any } # provided parameters

含まれているテンプレートで:

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

関連項目

テンプレートの使用について詳しくは、テンプレートに関する記事をご覧ください。