How to mark a build unstable in Jenkins when running shell scripts

后端 未结 14 2191
情歌与酒
情歌与酒 2020-11-27 11:31

In a project I\'m working on, we are using shell scripts to execute different tasks. Some are sh/bash scripts that run rsync, and some are PHP scripts. One of the PHP script

14条回答
  •  孤街浪徒
    2020-11-27 12:07

    You can just call "exit 1", and the build will fail at that point and not continue. I wound up making a passthrough make function to handle it for me, and call safemake instead of make for building:

    function safemake {
      make "$@"
      if [ "$?" -ne 0 ]; then
        echo "ERROR: BUILD FAILED"
        exit 1
      else
        echo "BUILD SUCCEEDED"
      fi
    }
    

提交回复
热议问题