Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash 仅为一条管道更换Jenkins外壳_Bash_Docker_Jenkins_Jenkins Pipeline - Fatal编程技术网

Bash 仅为一条管道更换Jenkins外壳

Bash 仅为一条管道更换Jenkins外壳,bash,docker,jenkins,jenkins-pipeline,Bash,Docker,Jenkins,Jenkins Pipeline,我如何让Jenkins使用Bash而不是它的原生shell来处理一个Jenkins管道/Jenkins文件?“代理人”帮我做这件事吗 我为部署编写了一个shell脚本,但是一些参数包含空格,这会丢失一些参数,从而导致生成的命令出错。我发现了如何通过将Jenkins shell类型全局配置为Bash来避免这个问题。但是,当我更改全局shell类型时,其他使用Jenkins docker插件语法的Jenkins管道在docker容器中使用“sh”命令时会被破坏。我的解决方法是根据我要运行的Jenki

我如何让Jenkins使用Bash而不是它的原生shell来处理一个Jenkins管道/Jenkins文件?“代理人”帮我做这件事吗


我为部署编写了一个shell脚本,但是一些参数包含空格,这会丢失一些参数,从而导致生成的命令出错。我发现了如何通过将Jenkins shell类型全局配置为Bash来避免这个问题。但是,当我更改全局shell类型时,其他使用Jenkins docker插件语法的Jenkins管道在docker容器中使用“sh”命令时会被破坏。我的解决方法是根据我要运行的Jenkins构建,对shell类型的全局设置进行乒乓处理。这是一个皇家皮塔。

我不好意思说我需要的只是一个

My Jenkins File使用Jenkin运行自定义(bash)shell脚本,如下所示:

sh "./deploy.sh \"arg1\" \"arg 2\" \"arg3\""
为了强制
deploy.sh
在Bash中运行,
deploy.sh
的内容需要包含
#/第一行的bin/bash
,如中所示:

#!/bin/bash
echo "deploy args: $@"

无论如何,我认为应该有一种方法告诉Jenkins管道它应该使用特定的设置运行,比如sh=bash。

您考虑过修改脚本吗?是的!在与詹金斯斗争了一段时间后,我需要继续前进。它在Bash中工作。让我们坚持主题。:)