don't fail jenkins build if execute shell fails

前端 未结 14 1234
无人共我
无人共我 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:40

    On the (more general) question in title - to prevent Jenkins from failing you can prevent it from seeing exit code 1. Example for ping:

    bash -c "ping 1.2.3.9999 -c 1; exit 0"
    

    And now you can e.g. get output of ping:

    output=`bash -c "ping 1.2.3.9999 -c 1; exit 0"`
    

    Of course instead of ping ... You can use any command(s) - including git commit.

提交回复
热议问题