Quantcast
Viewing all articles
Browse latest Browse all 290

jenkins中execute shell的注意事项

缺省jenkins的execute shell的方式是:

sh -xe hudsonxxx.sh  

说明一下:

-e 打开开关
+e 关上开关
-x 打开开关
+e 关上开关

详细解释一下:

set -e 表示一旦脚本中有命令的返回值为非0,则脚本立即退出,后续命令不再执行;

set -x 表示执行指令后,会先显示该指令及所下的参数。 

set -o pipefail表示在管道连接的命令序列中,只要有任何一个命令返回非0值,则整个管道返回非0值,即使最后一个命令返回0.  

注意在引用nvm以及meteor的环境中,要设置set +e 否则source nvm.sh的过程容易出错!


Viewing all articles
Browse latest Browse all 290

Trending Articles