don't fail jenkins build if execute shell fails

前端 未结 14 1247
无人共我
无人共我 2020-12-04 08:08

As part of my build process, I am running a git commit as an execute shell step. However, if there are no changes in the workspace, Jenkins is failing the build. This is be

14条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-04 08:39

    This answer is correct, but it doesn't specify the || exit 0 or || true goes inside the shell command. Here's a more complete example:

    sh "adb uninstall com.example.app || true"
    

    The above will work, but the following will fail:

    sh "adb uninstall com.example.app" || true
    

    Perhaps it's obvious to others, but I wasted a lot of time before I realized this.

提交回复
热议问题