jenkins-groovy - How does an &&, || work with jenkins pipeline groovy?
问题描述
I tried the below OR (||) to mark the build fail if any of the myTeststring1 OR myTeststring2 matches the console output. I tried few other ways with ||, it doesn't work. Any suggestion?
if (manager.logContains('.myTestString1.') || ('.myTestString2.')) {
error("Build failed because of this and that..")
}
I am trying to match two or more patterns to the Jenkins console output to mark build failure.
解决方案
试试下面的......在OR之后你需要提供一个表达式,在你的例子中你没有
if (manager.logContains('.myTestString1.') ||
manager.logContains('.myTestString2.')) {
error("Build failed because of this and that..")
}
推荐阅读
- android-service - 出现错误尝试使用损坏的通知启动前台服务(xxx)(无图标:通知(pri = 0 contentView = null ---
- php - 无停机 Laravel 部署
- regex - 没有在scala中正确拆分字符串
- python - 我刚刚创建了一个 Python 脚本。我正在尝试在我的 Windows 计算机上运行它。这没用
- python - 尝试在 Spyder (Python 3.7) 上安装新库
- javascript - React - 通过功能组件传递 props up 组件树
- angular - Angular 9 的交互式坐标系
- mysql - nodejs 服务器 app.post 问题 XML 解析错误:语法错误位置:http://localhost:3000/get_messages 第 1 行第 1 列:
- c# - WPF中切换用户控件只显示ViewModel的名称
- excel - 组合框列出路径中的最新 2 个文件夹