考虑来自 azure yaml 管道的以下工作
- job: create_slot
dependsOn: setup
displayName: 'Create slot'
pool:
vmImage: 'windows-latest'
variables:
slotName: $[ dependencies.setup.outputs['slot.name'] ]
steps:
- bash: |
echo "Slot to be created: $(slotName)"
displayName: 'Show slot name'
- template: templates/create-slot.yml
parameters:
slot: $(slotName)
从文档中,我希望我可以$(slotName)
直接用运行时表达式替换 marco $[ dependencies.setup.outputs['slot.name'] ]
,结果如下:
- job: create_slot
dependsOn: setup
displayName: 'Create slot'
pool:
vmImage: 'windows-latest'
steps:
- bash: |
echo "Slot to be created: $(slotName)"
displayName: 'Show slot name'
- template: templates/create-slot.yml
parameters:
slot: $[ dependencies.setup.outputs['slot.name'] ]
但是如果你这样做,管道就会失败
从错误中,我得到的印象是$[ dependencies.setup.outputs['slot.name'] ]
被踩在弦上。我在这里尝试的可能是什么,也许我的语法不正确。