jobs.template の定義
テンプレートで定義されているジョブのセット。
jobs:
- template: string # Required as first property. Reference to a template for this deployment.
parameters: # Parameters used in a deployment template.
特性
template
文字列。 最初のプロパティとして必要です。
このデプロイのテンプレートへの参照です。
テンプレート パラメーターを parameters
します。
デプロイ テンプレートで使用されるパラメーター。
注釈
1 つのファイルにジョブのセットを定義し、他のファイルで複数回使用できます。 ジョブ テンプレートの操作の詳細については、テンプレート を参照してください。
例示
メイン パイプラインで次の手順を実行します。
- template: string # name of template to include
parameters: { string: any } # provided parameters
含まれているテンプレートでは、次の手順を実行します。
parameters: { string: any } # expected parameters
jobs: [ job ]
この例では、3 つのプラットフォームで 1 つのジョブが繰り返されます。 ジョブ自体は 1 回だけ指定されます。
# File: jobs/build.yml
parameters:
name: ''
pool: ''
sign: false
jobs:
- job: ${{ parameters.name }}
pool: ${{ parameters.pool }}
steps:
- script: npm install
- script: npm test
- ${{ if eq(parameters.sign, 'true') }}:
- script: sign
# File: azure-pipelines.yml
jobs:
- template: jobs/build.yml # Template reference
parameters:
name: macOS
pool:
vmImage: macOS-latest
- template: jobs/build.yml # Template reference
parameters:
name: Linux
pool:
vmImage: ubuntu-latest
- template: jobs/build.yml # Template reference
parameters:
name: Windows
pool:
vmImage: windows-latest
sign: true # Extra step on Windows only
こちらもご覧ください
ジョブ テンプレートの操作の詳細については、テンプレート を参照してください。