Mos*_*she 4 jenkins jenkins-groovy jenkins-pipeline
我有一个管道阶段,我等待从sh脚本中获取某个字符串,并且只有当字符串匹配时,才继续到下一阶段,但是,它没有按预期工作:
node('master') {
stage("wait for bash completion") {
waitUntil {
def output = sh returnStdout: true, script: 'cat /tmp/test.txt'
output == "hello"
}
}
stage("execute after bash completed") {
echo "the file says hello!!!"
}
}
Run Code Online (Sandbox Code Playgroud)
执行是这样的:
+ cat /tmp/test.txt
[Pipeline] }
Will try again after 0.25 sec
[Pipeline] {
[Pipeline] sh
[workspace] Running shell script
+ cat /tmp/test.txt
[Pipeline] }
Will try again after 0.3 sec
[Pipeline] {
[Pipeline] sh
[workspace] Running shell script
+ cat /tmp/test.txt
[Pipeline] }
Will try again after 0.36 sec
...
(so on and so forth)
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
| 归档时间: |
|
| 查看次数: |
7532 次 |
| 最近记录: |