azure - YAML 模板可选步骤参数空值应该是什么?
问题描述
当使用这样的模板参数时:
parameters:
- name: runStep
type: step
它总是需要传递一个值。但是,我想将其设为可选:
parameters:
- name: runStep
type: step
default: ???
因为stepList
它可以这样做:
- name: runSteps
type: stepList
default: []
但是 type 怎么做step
呢?我可以添加一个“虚拟”默认值:
default:
script: echo 123
但是,我如何在条件下比较该值?我想做这样的事情:
- ${{ if parameters.runStep }}:
- ${{ parameters.runStep }}
解决方案
Would this work for you?
step:
- bash: |
if [ ${{parameters.runstep}} ]; then
${{parameters.runstep}}
fi
推荐阅读
- c++ - 是否有用于确定不超过数字 x 的最大元素的 std::set 函数?
- java - 以递归方式使用 java 8 CompletableFuture
- python - 使用 django 捕获网络摄像头图像并上传数据库
- linux - 让特定用户完全访问我拥有的任何东西 linux
- testing - 我可以使用嵌入式 iframe 吗?
- mysql - 我需要获取用户首次付款日期和用户注册日期之间的差值
- javascript - 每个生成的用户,都会生成两个新的 JS
- listview - 如何从列表中的其他项目触发 ListView 刷新
- azure-functions - 使用 Azure 函数将数据附加到 Blob 存储
- mysql - 如何判断 MySQL 转储的版本?