- Implementing Azure DevOps Solutions
- Henry Been Maik van der Gaag
- 147字
- 2021-06-24 16:11:12
Variables
Just like classic build pipelines, YAML pipelines support the use of variables. Variables can be defined at every level of a YAML pipeline (except for within a task) using the following syntax:
variables:
name: value
anotherName: otherValue
Variables can later be retrieved using the syntax that you already know from classic build pipelines—$(name) and $(anotherName).
It is also possible to reference existing variable groups from within a YAML pipeline. This is done by using the group keyword, instead of specifying the name of a variable. To also retrieve all the variables from a variable group called myVariableGroup, you would extend the preceding YAML, as follows:
variables:
name: value
anotherName: otherValue
group: myVariableGroup
Variables can be set at every level in a YAML pipeline, but only variables set at the root level can be overridden when queuing a new execution manually.