【发布时间】:2014-11-05 09:47:54
【问题描述】:
我们有几个 php 脚本与其他非 php 命令封装在一个 shell 脚本中,如下所示:
build_stuff.sh
mv things stuff
cp files folders
composer install
php bin/console some:command
php bin/console some:other:command
然后在“执行 shell”构建步骤中调用此 shell 脚本。
sh ./build_stuff.sh
一旦出现 php 错误/警告,是否有可能将构建中止为“失败”?
这样下一个命令就不会被执行。
并且仍然在一个脚本中维护所有命令。
...
我找到了 Log Parser Plugin,但我想在错误发生时中止,而不是在之后继续解析日志。
我可能会捕获 PHP 退出代码,如下所述:
Retrieve exit status from php script inside of shell script
但是您将无法立即看到 php 脚本的文本输出,对吗?
【问题讨论】:
-
错误码可以返回给shell。警告必须被覆盖才能产生相同的效果。
标签: php bash shell jenkins exit-code