1 つのファイルに変数のセットを定義し、他のファイルで複数回使用できます。
variables:
- template: string # Required as first property. Template file with variables.
parameters: # Parameters to map into the template.
この定義を参照する定義: 変数
特性
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 }}