The answer is yes. The usage of the predefined variable in Yaml pipeline is the same with classic pipeline. $(Release.EnvironmentName)
is for classic release pipeline. You can refer to variables $(System.StageName)
or $(Environment.Name)
in the yaml pipeline.
Click the links to find more predefined build variables. Check here to learn more about variables in yaml pipeline.
For variable groups scoped to stage in classic release pipeline
It is possible in Yaml pipeline. In yaml you can scope your variable groups in job or stage by define variables under job or stage in yaml. For below example.
1,Variables scoped to stage Build:
stages:
- stage: Build
variables:
- group: SourceMessage
jobs:
- job: A
- stage: release
jobs:
- job: B
2, Variables scoped to all stages:
stages:
variables:
- group: SourceMessage
- stage: Build
jobs:
- job: A
- stage: release
jobs:
- job: B
3, Variables scoped to job A:
stages:
- stage: Build
jobs:
- job: A
variables:
- group: SourceMessage
- stage: release
jobs:
- job: B