Ric*_*ano 3 expression jenkins jenkins-pipeline
我会评估 Jenkinsfile 的“when”语法中的两个条件。特别是,我需要检查 params.x 何时为 true,params.y 何时为 true。我可以使用“and”运算符将两者插入到同一表达式中吗?
小智 10
来自詹金斯文档:
Run Code Online (Sandbox Code Playgroud)expression Execute the stage when the specified Groovy expression evaluates to true, for example: when { expression { return params.DEBUG_BUILD } } Note that when returning strings from your expressions they must be converted to booleans or return null to evaluate to false. Simply returning "0" or "false" will still evaluate to "true".
因此,如果您插入有效的常规语句,它应该可以工作。
或者,您可以使用allOf
语句,例如
expression
Execute the stage when the specified Groovy expression evaluates to true, for example: when { expression { return params.DEBUG_BUILD } }
Note that when returning strings from your expressions they must be converted to booleans or return null to evaluate to false.
Simply returning "0" or "false" will still evaluate to "true".
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3963 次 |
最近记录: |