Jenkins pipeline sh fail with “cannot run program nohup” on windows

后端 未结 9 2022
野趣味
野趣味 2020-11-30 04:36

I have windows 10 and I want to execute the sh command in the Jenkinsfile from Jenkins pipeline using bash for Ubuntu for windows, but it doesn\'t work

I have the fo

9条回答
  •  遥遥无期
    2020-11-30 05:14

    From a very quick search, it looks like your error is related to the following issue : JENKINS-33708

    The main cause looks like the sh step is not supported on the Windows. You may use bat or install Cygwin for instance.

    Nevertheless two solutions were proposed in the previous link, suggesting you to do the following steps :

    • Install git-bash
    • Ensure the Git\bin folder (i.e.: C:\Program Files\Git\bin) is in the global search path, in order for Jenkins to find sh.exe
    • Make nohup available for Jenkins, doing the following in git-bash (adapt your paths accordingly) :
      • mklink "C:\Program Files\Git\bin\nohup.exe" "C:\Program Files\git\usr\bin\nohup.exe"
      • mklink "C:\Program Files\Git\bin\msys-2.0.dll" "C:\Program Files\git\usr\bin\msys-2.0.dll"
      • mklink "C:\Program Files\Git\bin\msys-iconv-2.dll" "C:\Program Files\git\usr\bin\msys-iconv-2.dll"
      • mklink "C:\Program Files\Git\bin\msys-intl-8.dll" "C:\Program Files\git\usr\bin\msys-intl-8.dll"

    Depending on your installation you may have to use these paths :

    • mklink "C:\Program Files\Git\cmd\nohup.exe" "C:\Program Files\git\usr\bin\nohup.exe"
    • mklink "C:\Program Files\Git\cmd\msys-2.0.dll" "C:\Program Files\git\usr\bin\msys-2.0.dll"
    • mklink "C:\Program Files\Git\cmd\msys-iconv-2.dll" "C:\Program Files\git\usr\bin\msys-iconv-2.dll"
    • mklink "C:\Program Files\Git\cmd\msys-intl-8.dll" "C:\Program Files\git\usr\bin\msys-intl-8.dll"

提交回复
热议问题