带有Bash的Windows 10上的Jenkins [英] Jenkins on Windows 10 with Bash

查看:118
本文介绍了带有Bash的Windows 10上的Jenkins的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在Windows 10上设置Jenkins服务器,希望能够使构建脚本更加跨平台,我希望利用Windows 10中可用的bash环境.

I'm currently setting up a Jenkins server on Windows 10, in the hope of being able to make the build scripts more cross platform I was hoping to take advantage of the bash environment that is available in Windows 10.

我希望可以通过将Jenkins中shell的路径设置为bash可执行文件来完成此操作,但是我在尝试使其工作时遇到了一些问题.

I hoped this could be done just by setting the path to the shell in Jenkins to be the bash executable, however I've encountered some problems with trying to get this to work.

首先,当我将路径设置为C:\Windows\System32\bash.exe时,詹金斯似乎无法看到此路径.

Firstly when I set the path to be C:\Windows\System32\bash.exe but Jenkins didn't seem to be able to see this path.

我认为这是因为Jenkins以32位运行,并将路径更改为C:\Windows\sysnative\bash.exe,但是当我尝试使用它时,我得到了错误

I assumed this was because Jenkins was running as 32-bit and changed the path to be C:\Windows\sysnative\bash.exe but when I try and use this I get the error

[workspace] $ C:\Windows\sysnative\bash.exe -xe    C:\Users\Jenkins\AppData\Local\Temp\hudson4346151084156392102.sh
Error: 0x80070005


Build step 'Execute shell' marked build as failure

我想我有点暗中摸索,所以我不知道是否有人有尝试在Jenkins中使用Windows 10上的bash shell的经验?

I think I'm poking around in the dark a bit so I didn't know if anyone had any experience of trying to use the bash shell on Windows 10 within Jenkins?

推荐答案

您可以在Windows上运行此命令以执行bash shell脚本:

You can run this on Windows in order to execute a bash shell script:

bash -c /mnt/c/Users/$LOGNAME/Downloads/abc.sh

确保脚本是可执行文件(chmod + x)

Make sure that the script is executable (chmod +x)

这篇关于带有Bash的Windows 10上的Jenkins的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆