• Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • pipeline-maven-plugin
    • None
    • Windows, cygwin, jenkins 2.46.1

      Running the pipeline tutorial ( https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md ) with :

       

      node("qa3.lab.company.com") {
        git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
        def mvnHome = tool 'mvn350'
        sh "${mvnHome}/bin/mvn -B verify"
      }

       

      Doesn't work on a cygwin slave.  The maven command just fails :

       

      Started by user Peter Lord
      [Pipeline] node
      Running on qa3.lab.company.com in /opt/company/users/jenkins/workspace/EventProcessing/test-nodeploy
      [Pipeline] {
      [Pipeline] git
       > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
       > git config remote.origin.url https://github.com/jglick/simple-maven-project-with-tests.git # timeout=10
      Fetching upstream changes from https://github.com/jglick/simple-maven-project-with-tests.git
       > git --version # timeout=10
       > git fetch --tags --progress https://github.com/jglick/simple-maven-project-with-tests.git +refs/heads/*:refs/remotes/origin/*
       > git rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
       > git rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
      Checking out Revision 7b64fc4ac386dd9e34df63feef99f2260ec9a6b0 (refs/remotes/origin/master)
       > git config core.sparsecheckout # timeout=10
       > git checkout -f 7b64fc4ac386dd9e34df63feef99f2260ec9a6b0
       > git branch -a -v --no-abbrev # timeout=10
       > git branch -D master # timeout=10
       > git checkout -b master 7b64fc4ac386dd9e34df63feef99f2260ec9a6b0
       > git rev-list 7b64fc4ac386dd9e34df63feef99f2260ec9a6b0 # timeout=10
      [Pipeline] tool
      Unpacking https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip to /opt/company/users/jenkins/tools/hudson.tasks.Maven_MavenInstallation/mvn350 on qa3.lab.company.com
      [Pipeline] sh
      [test-nodeploy] Running shell script
      + /opt/company/users/jenkins/tools/hudson.tasks.Maven_MavenInstallation/mvn350/bin/mvn -B verify
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      ERROR: script returned exit code -1
      Finished: FAILURE

      Running the same maven command when logged in manually works as expected.  Also the same pipeline works on OS/X and Linux slaves - it only fails on cygwin slaves under jenkins.

       

          [JENKINS-44276] Maven fails in pipeline + cygwin

          Peter Lord added a comment - - edited

          Ah, I found the required hint here https://github.com/jenkinsci/workflow-cps-plugin/blob/master/src/main/js/samples.js

          So the example should probabally be something like :

           

          node("qa3.lab.company.com") {
              git url: 'https://github.com/jglick/simple-maven-project-with-tests.git' 
              def mvnHome = tool 'mvn350'
              if (isUnix()) {
                 sh "${mvnHome}/bin/mvn -B verify"
              } else {
                 bat(/"${mvnHome}\bin\mvn" -B verify/)
             }
           }
           

          Peter Lord added a comment - - edited Ah, I found the required hint here https://github.com/jenkinsci/workflow-cps-plugin/blob/master/src/main/js/samples.js So the example should probabally be something like :   node( "qa3.lab.company.com" ) { git url: 'https: //github.com/jglick/simple-maven-project-with-tests.git' def mvnHome = tool 'mvn350' if (isUnix()) { sh "${mvnHome}/bin/mvn -B verify" } else { bat(/ "${mvnHome}\bin\mvn" -B verify/) } }

          Peter Lord added a comment -

          Downgraded - can we treat this as a doc issue ?

          Peter Lord added a comment - Downgraded - can we treat this as a doc issue ?

            Unassigned Unassigned
            plord Peter Lord
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: