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

后端 未结 14 2184
情歌与酒
情歌与酒 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:06

    Use the Text-finder plugin.

    Instead of exiting with status 1 (which would fail the build), do:

    if ($build_error) print("TESTS FAILED!");
    

    Than in the post-build actions enable the Text Finder, set the regular expression to match the message you printed (TESTS FAILED!) and check the "Unstable if found" checkbox under that entry.

提交回复
热议问题