Jenkins pipeline - null pointer exception
Closed this issue · 4 comments
Hi, I have the following in my Jenkinsfile
stage('Analysis') {
step([$class: 'StaticAssessmentBuildStep',
bsiToken: 'mytoken',
entitlementPreference: 2,
includeAllFiles: false,
includeThirdPartyOverride: true,
isBundledAssessment: false,
isExpressAuditOverride: false,
isExpressScanOverride: false,
isRemediationPreferred: false,
overrideGlobalConfig: false,
purchaseEntitlements: false,
runOpenSourceAnalysisOverride: true])
}
but I keep getting the error:
Starting FoD Upload.
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.lang.NullPointerException
at org.jenkinsci.plugins.fodupload.StaticAssessmentBuildStep.perform(StaticAssessmentBuildStep.java:136)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:51)
at hudson.security.ACL.impersonate(ACL.java:260)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:48)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE
It works and picks up the global config if I use a freestyle project so I know the connectivity is ok?
Any idea what I'm missing?
Hi Alan,
This seems to be a usage issue. Please check for the following:
Are you on the latest version of the plugin?
Are you using the correct Pipeline syntax for fodStaticAssessment and fodPollResults?
If you still have issues, please contact the Fortify on Demand support team through the Help Center.
Hi Thanks for the reply - this is my jenkinsfile - can you advise on what I'm missing?
node('docker-slave') {
stage('Checkout') {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[url: 'https://my.repo.git']]])
}
stage('Build') {
withMaven {
sh 'mvn clean install'
}
}
stage('Analysis') {
step([$class: 'StaticAssessmentBuildStep',
bsiToken: 'mytoken',
entitlementPreference: 2,
includeAllFiles: false,
includeThirdPartyOverride: true,
isBundledAssessment: false,
isExpressAuditOverride: false,
isExpressScanOverride: false,
isRemediationPreferred: false,
overrideGlobalConfig: false,
purchaseEntitlements: false,
runOpenSourceAnalysisOverride: true])
}
}
Are you using the correct pipeline syntax? "StaticAssessmentBuildStep" appears to refer to the post-build task, "fodStaticAssessment" is the pipeline task.
Ah ok - sorry my bad. I notice these have been added in 3.0.12 and I have 3.0.10.
Will close - apologies and thanks for your help