- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 azure devops 在拉取请求管道中动态设置组。 Yaml 文件如下所示:
variables:
- ${{ if eq(variables['System.PullRequest.TargetBranch'], 'refs/heads/dev') }}:
- group: dev-var-group
这不起作用,条件被评估为“假”。只是为了确认这一点,我颠倒了如下条件
variables:
- ${{ if ne(variables['System.PullRequest.TargetBranch'], 'refs/heads/dev') }}:
- group: dev-var-group
正确设置该组后,读取所有必需的变量并且管道工作。
任何人都可以在这里提供帮助,使其在正确的条件下工作吗?
最佳答案
恐怕这是不可能的。如果你看here在Template expression syntax
:
You can use template expression syntax to expand both template parameters and variables (${{ variables.var }}). Template variables are processed at compile time, and are replaced before runtime starts. Template expressions are designed for reusing parts of YAML as templates.
Template variables silently coalesce to empty strings when a replacement value isn't found. Template expressions, unlike macro and runtime expressions, can appear as either keys (left side) or values (right side). The following is valid: ${{ variables.key }} : ${{ variables.value }}.
要使其正常工作,您需要一个模板变量和 System.PullRequest.TargetBranch
是运行时变量,因此它被替换为空字符串。如果您检查预定义变量 here你会注意到最后一栏Available in templates?
上面写着no
对于 System.PullRequest.TargetBranch
关于azure - 使用 System.PullRequest.TargetBranch 动态设置变量组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63941345/
我正在尝试使用 azure devops 在拉取请求管道中动态设置组。 Yaml 文件如下所示: variables: - ${{ if eq(variables['System.PullReque
我正在尝试使用 azure devops 在拉取请求管道中动态设置组。 Yaml 文件如下所示: variables: - ${{ if eq(variables['System.PullReque
我有一个管道模板,它应该根据拉取请求目标分支接收不同的输入。 模板: parameters: - name: BUILD_FOLDER type: string steps: - script:
我是一名优秀的程序员,十分优秀!