Jenkinfile groovy 面临着 bash 的 while 循环问题
我有一个基于其结果的脚本,我想运行 while 循环,当其状态更改需要打破 while 循环时。但是我看到它进入 while 循环。对此的任何帮助都会非常有帮助
cat status.sh
echo "RUNNING"
cat status1.sh
echo "Aborted"
Jenkinfile.script 如下
script{
sh '''#!/bin/bash
cd /Proj/scripts/
pwd
foo=0
status=$(sh status.sh)
echo "${status}"
while [ "${status}" == "RUNNING|Queued" ]; do
sleep 10
status=$(sh status1.sh)
echo ".."
done
'''
}
结果:
[Pipeline] sh
/Proj/scripts/
RUNNING
我认为它没有执行 while 循环,这里有任何提示。
I have a script based on its result, I wanted to run the while loop, when its status changes need to break out of while loop. However I am seeing it entering the while loop. Any help on this would be very helpful
cat status.sh
echo "RUNNING"
cat status1.sh
echo "Aborted"
Jenkinfile.script as follow
script{
sh '''#!/bin/bash
cd /Proj/scripts/
pwd
foo=0
status=$(sh status.sh)
echo "${status}"
while [ "${status}" == "RUNNING|Queued" ]; do
sleep 10
status=$(sh status1.sh)
echo ".."
done
'''
}
Result:
[Pipeline] sh
/Proj/scripts/
RUNNING
I think its not executing the while loop, any hint here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论