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

FAILURE to fingerprint SNAPSHOT dependecy when jenkins user exists on docker image

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • pipeline-maven-plugin
    • None
    • BS Centos7, jenkins 2.97, pipeline-maven-plugin 3.2.0-alpha-2, docker-workflow-plugin 1.14

      A warning is seen on fingerprint an artifact with SNAPSHOT version, if jenkins user already exists inside a docker container. The build does NOT fail.

      [withMaven] FAILURE to fingerprint org/apache/maven/plugins/maven-patch-plugin/1.3-SNAPSHOT/maven-patch-plugin-1.3-SNAPSHOT.jar, file not found
      

      The file exists inside:

      + find /var/lib/jenkins/ -iname maven-patch-plugin-1.3-SNAPSHOT.jar
      /var/lib/jenkins/.m2/repository/org/apache/maven/plugins/maven-patch-plugin/1.3-SNAPSHOT/maven-patch-plugin-1.3-SNAPSHOT.jar
      

      When using maven:3.5.0 docker image, the fingerprint is done correctly and no warning is seen.

      Example of a custom docker image:

      Using /home/jenkins as home folder triggers the same warning although the file is going to be located at:

      + find /home/jenkins/ -iname maven-patch-plugin-1.3-SNAPSHOT.jar
      /home/jenkins/.m2/repository/org/apache/maven/plugins/maven-patch-plugin/1.3-SNAPSHOT/maven-patch-plugin-1.3-SNAPSHOT.jar
      

       

      When removing the user creation from custom docker image, the fingerprint is done sucessfully and the file is located at:

      + find /var/lib/jenkins/ -iname maven-patch-plugin-1.3-SNAPSHOT.jar
      /var/lib/jenkins/workspace/Tests/withMaven_tests/withMaven-test2/?/.m2/repository/org/apache/maven/plugins/maven-patch-plugin/1.3-SNAPSHOT/maven-patch-plugin-1.3-SNAPSHOT.jar
      

      Maven Repository folder is located inside the workspace and will be deleted as soon the container is destroyed.
      Having the artifacts repository available outside the workspace is usefull to avoid redownload all artifacts on every build.
      At the moment, mounting extra volumes, seems not to be working. Issue here

      Dockerfile:

      FROM ubuntu:16.04
      
      RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
          maven \
          openjdk-8-jdk
      
      RUN addgroup --gid 991 jenkins && \
          useradd -d /var/lib/jenkins -u 995 -g 991 jenkins && \
          mkdir -p /var/lib/jenkins && \
          chown -R jenkins:jenkins /var/lib/jenkins
      

      Jenkinsfile:

      node('docker') {
          deleteDir()
          stage('build') {
              myimage = docker.image('your_custom_image')
              myimage.pull()
              myimage.inside() {
                  git url: 'https://your-custom-spring-petclinic.git'
                  withMaven(){
                      sh "mvn clean package"
                      sh 'pwd'
                      sh 'find /var/lib/jenkins/ -iname maven-patch-plugin-1.3-SNAPSHOT.jar'
                      sh 'whoami'
                      sh 'echo $HOME'
                  }
              }
          }
      }
      

      Test based on Pet Clinic project , with a random SNAPSHOT dependency added.

      pom.xml file:

      ...
        <dependencies>
        ...
        <!-- Test withMaven SNAPSHOT dependency fingerprint-->
          <dependency>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-patch-plugin</artifactId>
              <version>1.3-SNAPSHOT</version>
          </dependency>
        </dependencies>
      ...
      <pluginRepositories>
            <pluginRepository>
                <id>apache.snapshots</id>
                <url>http://repository.apache.org/snapshots/</url>
            </pluginRepository>
        </pluginRepositories>
        <repositories>
            <repository>
                <id>apache.snapshots</id>
                <name>Apache Snapshot Repository</name>
                <url>http://repository.apache.org/snapshots</url>
                <releases>
                    <enabled>false</enabled>
                </releases>
            </repository>
      ...
      

          [JENKINS-48844] FAILURE to fingerprint SNAPSHOT dependecy when jenkins user exists on docker image

          There are no comments yet on this issue.

            Unassigned Unassigned
            ncosta Nuno Costa
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: