【发布时间】:2017-05-23 11:10:39
【问题描述】:
我正在尝试在 GROOVY 脚本中实现以下功能,但出现错误:
读取数组中 HTML 文件的内容,然后通过 grep 读取该数组中的内容。
def file1 = new File("/path/to/the/file/xyz.html");
def lines = file1.readLines()
if ((-e "/path/to/the/file/xyz.html") and (!(grep /jira.bugtracker.com/, lines))
{
println (" the changes are present\n");
exit 0;
}
else
{
println (" the changes are not present\n");
exit 1;
}
请检查代码并提出正确的方法。
【问题讨论】:
-
您遇到了什么错误?这是在 Jenkinsfile 的上下文中吗?可以发一下吗?
标签: jenkins groovy jenkins-pipeline groovyshell