variables.template definition

You can define a set of variables in one file and use it multiple times in other files.

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

Definitions that reference this definition: variables

Properties

template string. Required as first property.
Template file with variables.

parameters template parameters.
Parameters to map into the template.

Examples

In this example, a set of variables is repeated across multiple pipelines. The variables are specified only once.

# 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 }}

See also