使用Shell脚本在Jenkins中手动构建失败吗 [英] Do manual build fail in Jenkins using shell script
本文介绍了使用Shell脚本在Jenkins中手动构建失败吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如,我想将Jenkins构建标记为在一种情况下失败:
I would like to mark a Jenkins build to fail on one scenario for example:
if [ -f "$file" ]
then
echo "$file found."
else
echo "$file not found."
#Do Jenkins Build Fail
fi
可以通过Shell脚本吗?
Is it possible via Shell Script?
答案::如果我们以整数1退出,则Jenkins构建将被标记为失败.因此,我用exit 1
替换了注释以解决此问题.
Answer: If we exit with integer 1, Jenkins build will be marked as failed. So I replaced the comment with exit 1
to resolve this.
推荐答案
所有您需要做的就是退出1.
All you need to do is exit 1.
if [ -f "$file" ]
then
echo "$file found."
else
echo "$file not found."
exit 1
fi
这篇关于使用Shell脚本在Jenkins中手动构建失败吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文