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

java.lang.NullPointerException with archiveArtifacts

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • core
    • None
    • Debian and Centos
      Jenkins 2.321
    • 2.340

    Description

      Our call to archiveArtifacts fails with a java.lang.NullPointerException.

      The call to archiveArtifacts  is from inside a Jenkins shared library file

      // File: libs/vars/doSomething.groovy
      archiveArtifacts artifacts: 'build/licenses/**', fingerprint: true, allowEmptyArchive: true, followSymlinks: false

       

      This is called from our pipeline script as follow:

      // File: Jenkinsfile.groovy
      pipeline {
         ...
         stage ('') {
             matrix { 
                 ...
                 stages {
                    ...
                     stage('archive stage') {
                         steps {
                             script {
                                 ... 
                                 doSomething( ... )
                             }
                         }
                     }
                 }
             }
         }
      }

      This worked for quite a long time until recently and then it started failing. 

      If I look at the Build Artifacts of the job it seems like it did archive a lot of "licenses".

      We have a preceding archiveArtifacts call that does not fail.

      For now I have wrapped the call in a try-catch block and at least it does not fail the build anymore and it reports the exception in the log:

      try {
          archiveArtifacts artifacts: 'build/licenses/**', fingerprint: true, allowEmptyArchive: true, followSymlinks: false
      }
      catch (Exception e) {
          echo 'Exception occurred with archive licenses: ' + e.toString()
      }
      

      The build log output

      [Pipeline] archiveArtifacts
      Archiving artifacts
      Recording fingerprints
      [Pipeline] echo
      Exception occurred with archive licenses: java.lang.NullPointerException
      

       

      Attachments

        1. Jenkinsfile.groovy
          1 kB
          Carel Combrink

        Activity

          People

            Unassigned Unassigned
            carelc Carel Combrink
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: