Azure DevOps YAML 中变量支持和语法的一致性差异很大。一个例子:
trigger:
- master
# Variable Group has $(testCategory1) with value
# 'TestCategory=bvttestonly | TestCategory=logintest'
variables:
- group: DYNAMIC_VG
jobs:
- job:
pool: 'MyPool' #Has about 10+ self hosted agents
strategy:
parallel: $[ variables['noOfVMsDynamic']]
variables:
indyx: '$(testCategories$(System.JobPositionInPhase))'
indyx2: $[ variables['indyx'] ]
testCategories: $[ variables[ 'indyx2' ] ]
steps:
- script: |
echo "indyx2 - $(indyx2)"
echo "testCategories $(testCategories)"
displayName: 'Display Test Categories'
步骤打印:
"indyx2 - $(testCategories1)"
"testCategories $(testCategories1)"
我需要打印变量组中定义的 $(testCategories1) 的值:
'TestCategory=bvttestonly | TestCategory=logintest'