Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-40484

Unable to use withMaven() step inside docker container for old versions of Docker

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I'm not able to use withMaven step inside docker container.

      [Pipeline] withMaven
      $ docker exec ffff env printenv MAVEN_HOME
      $ docker exec ffff env printenv M2_HOME
      $ docker exec ffff env /bin/sh -c "which mvn"
      Using maven exec: /opt/apache-maven-3.3.9/bin/mvn
      Using global settings config with name MavenGlobal
      Replacing all maven server entries not found in credentials list is false
      [Pipeline] {
      [Pipeline] sh
      
      [test-XXX] Running shell script
      nohup: failed to run command `sh': No such file or directory
      
      [Pipeline] }
      [Pipeline] // withMaven

      My Jenkinsfile pipeline:

      node('docker') {
          stage('Checkout') {
              checkout scm
          }
          buildInDocker('linux') {
              stage('Maven') {
                  withMaven(globalMavenSettingsConfig: '11111111-2222-3333-4444-555555555555') {
                          sh 'mvn clean test'
                  }
              }
          }
      }

      It looks like PATH env gets overwritten.

        Attachments

          Issue Links

            Activity

            Show
            cleclerc Cyrille Le Clerc added a comment - - edited Please follow-up on JENKINS-47823 . See my comment https://issues.jenkins-ci.org/browse/JENKINS-47823?focusedCommentId=319156&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-319156
            Hide
            stodorov Steve Todorov added a comment -

            Cyrille Le Clerc I would like to start by saying that really appreciate your work and efforts in providing a fix/workaround for this issue. 

            However, I'm quite disappointed by this change. When we upgraded back in November 2017 (JENKINS-47805) all of our builds turned red because of the `$PATH` changes in the Docker Pipeline plugin. This makes me doubt what's the purpose of using `withMaven` if it can't do the things it's supposed to do and we're constantly having to use "workarounds"? To name just a few - we need to always have a `post -> always` block that ensures `jUnit` records the tests, now we have to use `configFileProvider` for the `settings.xml`, maybe use the mvn wrapper script... We could just as "easily" add 4 or 5 more pipeline declarations and do things manually instead of using `withMaven`. So what's exactly does `withMaven` do other than decorate the syntax?

            Show
            stodorov Steve Todorov added a comment - Cyrille Le Clerc I would like to start by saying that really appreciate your work and efforts in providing a fix/workaround for this issue.  However, I'm quite disappointed by this change. When we upgraded back in November 2017 ( JENKINS-47805 ) all of our builds turned red because of the `$PATH` changes in the Docker Pipeline plugin. This makes me doubt what's the purpose of using `withMaven` if it can't do the things it's supposed to do and we're constantly having to use "workarounds"? To name just a few - we need to always have a `post -> always` block that ensures `jUnit` records the tests, now we have to use `configFileProvider` for the `settings.xml`, maybe use the mvn wrapper script... We could just as "easily" add 4 or 5 more pipeline declarations and do things manually instead of using `withMaven`. So what's exactly does `withMaven` do other than decorate the syntax?
            Hide
            acejam Joshua Noble added a comment - - edited

            I hit this issue again today for the second time. Docker Pipeline 1.14 is unusable and causes `withMaven` to break when used from within a Docker container. Using containers is one of the best features of pipelines, so this is pretty critical functionality IMO.

            Show
            acejam Joshua Noble added a comment - - edited I hit this issue again today for the second time. Docker Pipeline 1.14 is unusable and causes `withMaven` to break when used from within a Docker container. Using containers is one of the best features of pipelines, so this is pretty critical functionality IMO.
            Hide
            acejam Joshua Noble added a comment -

            Any updates on this?

            Show
            acejam Joshua Noble added a comment - Any updates on this?
            Hide
            stodorov Steve Todorov added a comment - - edited

            ++Joshua Noble try reverting to an older version of Docker Pipeline. I have been using the older version since this issue hit me in JENKINS-47805. It seems that you can fix this either by using a mvnw, downgrade to an older version of Docker Pipeline or wait for JENKINS-48050 which looks like it will fix it for good.

            Show
            stodorov Steve Todorov added a comment - - edited ++ Joshua Noble try reverting to an older version of Docker Pipeline. I have been using the older version since this issue hit me in JENKINS-47805 . It seems that you can fix this either by using a mvnw, downgrade to an older version of Docker Pipeline or wait for JENKINS-48050  which looks like it will fix it for good.

              People

              • Assignee:
                cleclerc Cyrille Le Clerc
                Reporter:
                testuser7 Test User
              • Votes:
                10 Vote for this issue
                Watchers:
                21 Start watching this issue

                Dates

                • Created:
                  Updated: