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

Artifactory GradleBuild does not work within docker.inside

    Details

    • Similar Issues:

      Description

      The following Pipeline steps result in an error:

      docker.image(buildimage.imageName()).inside {
                def gradleBuildInfo = Artifactory.newBuildInfo()
                def rtGradle = Artifactory.newGradleBuild()
                rtGradle.resolver server: artifactory, repo: 'gradle-virtual'
                rtGradle.deployer server: artifactory, repo: 'gradle-virtual'
                rtGradle.setUseWrapper(true)
                rtGradle.deployer.setUsesPlugin(true)
                sh 'chmod +x ./gradlew'
                rtGradle.run rootDir: './', buildFile: 'build.gradle', tasks: 'clean resolve', buildInfo: gradleBuildInfo, switches: '--debug --no-daemon'
                sh './build.sh'
                buildInfo.append(gradleBuildInfo)
                buildInfo.env.collect
              }
      

      Jenkins output (debug output omitted):

      10:02:40.139 [LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger] 
      10:02:40.142 [LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger] BUILD SUCCESSFUL
      10:02:40.142 [LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger] 
      10:02:40.143 [LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger] Total time: 21.119 secs
      ERROR: Couldn't read generated build info at : /tmp/generated.build.info8459496679867578376.json
      

      When the steps are not enclosed in docker.inside everything works fine.
      My guess is that the Jenkins artifactory plugin creates files in the /tmp dir of the slave running the container instead of either using the workspace@tmp dir or the /tmp inside the container. After the gradle run the Jenkins plugin tries to read the file from /tmp in the container, where it was never created.
      We want to run multiple containers per slave so mounting the /tmp directory in the container is not possible.

        Attachments

          Activity

          Hide
          docwhat Christian Höltje added a comment -

          This is also true of Maven builds as well.

          Show
          docwhat Christian Höltje added a comment - This is also true of Maven builds as well.
          Show
          weakcamel Waldek M added a comment - See: https://www.jfrog.com/jira/browse/HAP-937 https://www.jfrog.com/jira/browse/HAP-932

            People

            • Assignee:
              eyalbe Eyal Ben Moshe
              Reporter:
              stefan_lengauer Stefan Lengauer
            • Votes:
              4 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated: