系统相关
首页 > 系统相关> > Jenkins Build step 'Execute shell' marked build as failure

Jenkins Build step 'Execute shell' marked build as failure

作者:互联网

背景:

  命名命令执行了也成功了,但是jenkins标记为失败,且提示 Build step 'Execute shell' marked build as failure

 

解决:

  在步骤“Execute shell”命令最上面添加

#!/bin/bash

  解释:

默认情况下,Jenkins采取/bin/sh -xe这种方式-x将打印每一个命令。另一个选项-e,当任何命令以非零值(当任何命令失败时)退出代码时,这会导致shell立即停止运行脚本。

#!/bin/bash是指此脚本使用/bin/bash来解释执行。

其中,#!是一个特殊的表示符,其后,跟着解释此脚本的shell路径。

bash只是shell的一种,还有很多其它shell,如:sh,csh,ksh,tcsh,...

#!/bin/bash只能放在第一行,如果后面还有#!,那么只能看成是注释。

标签:bin,Execute,shell,marked,命令,bash
来源: https://www.cnblogs.com/gcgc/p/15927221.html