Failure / Unstable via Script Return Code

后端 未结 6 1928
别那么骄傲
别那么骄傲 2020-12-11 04:04

I would like to get the result of my jenkins build job either failed (red), unstable (yellow) or successfull (green)...

If i return non zero from my shell script i c

6条回答
  •  暖寄归人
    2020-12-11 04:27

    Update: Newer versions of Jenkins support exit codes that would set unstable. For more info, please refer here (thanks @Pedro and @gib)

    I did not test this.

    Original answer below:

    No. A script exit code will not produce UNSTABLE build result in Jenkins.

    The only way to set UNSTABLE build result is programmatically through Jenkins.

    This is what the test harness portion of Jenkins does.

    You can also use the Jenkins CLI directly from your script to set result of the currently executing build. Instead of returning a specific exit code, have your script execute the Jenkins CLI command. For details, on your own server, goto http:///cli/command/set-build-result

    There are also a number of plugins that can do that same, including:

    • Text-finder plugin.
    • Fail the build plugin (it can set any status), but you will need to use it together with Conditional Build Step plugin.
    • Groovy plugin (will need to figure out full Groovy code).
    • Groovy post-build plugin (comes with easy method to set build result).

提交回复
热议问题