-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
Debian and Centos
Jenkins 2.321
-
-
2.340
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