問題出現:
Jenkins一直都構建成功,今天突然報錯:Jenkins Build step 'Execute shell' marked build as failure
問題原因:
By default Jenkins take /bin/sh -xe and this means -x will print each and every command.And the other option -e, which causes shell to stop running a script immediately when any command exits with non-zero (when any command fails) exit code.
解決辦法:
通過問題原因基本確定是因為-e或者-x導致構建失敗(我這邊是因為-x導致磁盤空間不足),所以我們在"Execute shell"的開頭加上"#!/bin/sh" 或"#!/bin/bash"就可以了。