我已经在Windows10 Pro上安装了jenkins服务器,并在系统上安装了ubuntu bash。我创建了一个Executable windows batch command并将命令bash -c ls放在此处。执行此作业时,出现以下错误:

c:\jenkins\workspaces>bash -c ls
'bash' is not recognized as an internal or external command,
operable program or batch file.

它说bash不被识别为内部或外部命令。然后,我尝试使用绝对路径,但仍然无法正常工作。错误显示如下:
c:\jenkins\workspaces>C:\Windows\System32\bash.exe -c ls
'C:\Windows\System32\bash.exe' is not recognized as an internal or external command,
operable program or batch file.

我可以在Windows上手动运行命令。如何在jenkins上进行配置?我需要从Windows普通命令窗口运行build命令,在我的构建脚本中,它需要在bash中启动一个进程。

最佳答案

您可以安装包括bash在内的MsysGit,在Jenkins中,您必须设置shell可执行文件,这是sh.exe的路径。
您也可以安装cygwin,但我认为这仅在运行bash脚本时使用大量RAM。

10-05 21:15
查看更多