How to mark Jenkins builds as SUCCESS only on specific error exit values (other than 0)?

后端 未结 6 1455
遥遥无期
遥遥无期 2021-02-14 03:37

When I run an Execute shell build step to execute a script and that script returns 0, Jenkins flags the build as SUCCESS, oth

6条回答
  •  青春惊慌失措
    2021-02-14 03:58

    /path/to/myscript.sh || if [ "$?" == "$EXPECTED_EXIT_CODE" ]; then continue; else exit 1; fi
    

    I would use continue instead of exit 0 in case you have other items below that you need to run through.

提交回复
热议问题