【发布时间】:2022-01-07 02:44:05
【问题描述】:
文件位于 Linux 工作节点上的 /opt/apps/workspace/build32/target/site/result.html。构建在/opt/apps/workspace/build32 文件夹下运行。下面是我正在使用的代码 sn-p。
if (fileExists("/opt/apps/workspace/build32/target/site/result.html")) {
echo "result.html file exist"
}
else {
echo " File does not exist"
}
def file = new File("/opt/apps/workspace/build32/target/site/result.html").collect{it}
def index = file.findIndexOf{ it ==~ /.*Result.*/ }
echo "file[index]"
输出:
Running in /opt/apps/workspace/build32.
[pipeline] result.html file exist
[pipeline] build status UNSTABLE build message there was an error on stage Test, result.html (No such file or directory)
【问题讨论】:
-
输出:在 /opt/apps/workspace/build32 中运行。 [pipeline] [pipeline] result.html 文件存在 [pipeline] build status UNSTABLE build message there was an error on stage Test, result.html (No such file or directory)
标签: jenkins groovy jenkins-pipeline jenkins-groovy