【发布时间】:2020-11-07 16:57:11
【问题描述】:
我在 Pipeline UI 中创建了一个名为 Test 的变量,并将值留空。于是出现如下图。
我正在尝试在 YAML 管道中访问此变量,但无法检查它是否为空值。
我正在尝试这样:
- variables
- name: 'Release'
${{ if or(eq(variables['Test'],''), eq(variables['Test'], 'undefined')) }}:
value: 'Stage'
${{ if and(ne(variables['Test'],''), ne(variables['Test'], 'undefined')) }}:
value: 'Test'
变量Release 的值始终为Stage,无论Test 变量为空还是其中的任何值。
我认为必须有一种简单的方法来检查变量值是否为空?
【问题讨论】:
-
嗨@Venky。机票有更新吗?如果答案能给你一些帮助,你可以考虑accepting the useful one as answer。这样它可以帮助遇到同样问题的其他社区成员,谢谢。
标签: azure azure-devops yaml devops multistage-pipeline