詹金斯在Windows 10上使用Bash

use*_*723 5 bash jenkins windows-10

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

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

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

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

[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
Run Code Online (Sandbox Code Playgroud)

我想我在黑暗中稍微瞎了一下,所以我不知道是否有人尝试在Jenkins的Windows 10上使用bash shell?

Den*_*erg -1

您可以在 Windows 上运行它来执行 bash shell 脚本:

bash -c /mnt/c/Users/$LOGNAME/Downloads/abc.sh
Run Code Online (Sandbox Code Playgroud)

确保脚本可执行(chmod +x)(仅适用于安装了 Linux 子系统的 Windwos 10)