我想标记一个Jenkins构建在一个场景下失败,例如:
if [ -f "$file" ] then echo "$file found." else echo "$file not found." #Do Jenkins Build Fail fi
是否可以通过Shell脚本?
答:如果我们退出整数1,Jenkins构建将被标记为失败。所以我用exit 1替换了这个注释来解决这个问题。
所有你需要做的是退出1。
if [ -f "$file" ] then echo "$file found." else echo "$file not found." exit 1 fi