我是使用 yaml 编写管道的新手,并且偶然发现了“运行时和编译时表达式”。
我知道我应该将 ${{}}
用于编译时表达式,将 $[]
用于运行时表达式,但是我在执行以下操作时遇到了问题:
parameters:
- name: customName
type: string
default: ''
variables:
${{ if eq(parameters.customName, '')}}
branchName: $(Build.SourceBranch)
${{ if not(eq(parameters.customName, ''))}}
branchName: ${{parameters.customName}}
${{ if eq(variables['branchName'], variables['Build.SourceBranch])}}: # this line isn't working
# set more variables ...
现在我遇到了最后一个 if 语句的问题。我认为问题在于“branchName”在设置为“Build.SourceBranch”时是一个运行时变量,但在设置为给定参数时可能是一个编译时变量。
我在尝试使用 yaml 是否可行?
我找不到示例,正在尝试类似的东西