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

后端 未结 9 1957
野趣味
野趣味 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:21

    If you are executing on Windows, just change sh to bat. it will work as expected. Example:

    pipeline { agent any stages { stage ('Compile Stage') {

            steps {
                withMaven(maven : 'apache-maven-3.6.1') {
                    bat'mvn clean compile'
                }
            }
        }
    

    } }

    0 讨论(0)
  • 2020-11-30 05:21

    In my case I replaced 'sh' by 'bat' in Pipeline script and worked.

    0 讨论(0)
  • 2020-11-30 05:23

    With Git for Windows 2.16.2, I was able to add C:\Program Files\Git\usr\bin to the PATH (rather than C:\Program Files\Git\bin) and consequently my sh commands work in both FreeStyle and Pipeline builds. No mklink was necessary. (Source)

    0 讨论(0)
提交回复
热议问题