variables.template 定義

1 つのファイル内で一連の変数を定義し、それを他のファイルで複数回使用できます。

variables:
- template: string # Required as first property. Template file with variables.
  parameters: # Parameters to map into the template.

この定義を参照する定義: 変数

Properties

template 文字列。 最初のプロパティとして必須。
変数を含むテンプレート ファイル。

parameters テンプレート パラメーター。
テンプレートにマップするパラメーター。

次の例では、一連の変数が複数のパイプラインにわたって繰り返されます。 それらの変数は 1 回しか指定されていません。

# File: variables/build.yml
variables:
- name: vmImage
  value: vs2017-win2016
- name: arch
  value: x64
- name: config
  value: debug
# File: component-x-pipeline.yml
variables:
- template: variables/build.yml  # Template reference
pool:
  vmImage: ${{ variables.vmImage }}
steps:
- script: build x ${{ variables.arch }} ${{ variables.config }}
# File: component-y-pipeline.yml
variables:
- template: variables/build.yml  # Template reference
pool:
  vmImage: ${{ variables.vmImage }}
steps:
- script: build y ${{ variables.arch }} ${{ variables.config }}

関連項目