NullPointerException in StatusVerifier.isRunAllowed
Hi,
I have a problem setting up the gitRPStatusPublisher in my declarative pipeline, the following exception is thrown:
java.lang.NullPointerException
at org.jenkinsci.plugins.github.pullrequest.utils.StatusVerifier.isRunAllowed(StatusVerifier.java:27)
at org.jenkinsci.plugins.github.pullrequest.publishers.impl.GitHubPRBuildStatusPublisher.perform(GitHubPRBuildStatusPublisher.java:79)
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:50)
at hudson.security.ACL.impersonate(ACL.java:290)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:47)
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)
in my declarative pipeline I have a build stage configured like this:
stage('Build') {
steps {
echo "Perform Build"
sh "./gradlew assemble"
}
post {
always {
githubPRStatusPublisher buildMessage: message(failureMsg: githubPRMessage('Can\'t set status; build failed.'), successMsg: githubPRMessage('Can\'t set status; build succeeded.')), errorHandler: statusOnPublisherError('UNSTABLE'), statusMsg: githubPRMessage('${GITHUB_PR_COND_REF} run ended'), statusVerifier: allowRunOnStatus('SUCCESS'), unstableAs: 'FAILURE'
}
}
}
For the githubPRStatusPublisher call I used the pipeline syntax tool creating the command.
Is there anything I miss-configured for my the job?
same issue here
Error when executing success post condition:
java.lang.NullPointerException
at org.jenkinsci.plugins.github.pullrequest.utils.StatusVerifier.isRunAllowed(StatusVerifier.java:27)
at org.jenkinsci.plugins.github.pullrequest.publishers.impl.GitHubPRCommentPublisher.perform(GitHubPRCommentPublisher.java:59)
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:50)
at hudson.security.ACL.impersonate(ACL.java:290)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:47)
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)
Jenkins ver. 2.136 GitHub Integration Plugin 0.2.3
Looks like run.getResult() is null. It seems that workflow job doesn't set run status because user should control it itself?
Existing code do null check for statusVerifier field. Try not set it
statusVerifier: allowRunOnStatus('SUCCESS')
at all and control workflow flow with workflow code logic.
Running into the same issue. I've tried running with and without statusVerifier set to various things. If I don't set statusVerifier to anything, Jenkins complains I'm not setting a necessary parameter. If I do set it to anything, I get the NPE. What's the deal?
If I don't set
statusVerifierto anything, Jenkins complains I'm not setting a necessary parameter
could you show the log?
There is any update with the issue, I am failing on the same thing
githubPRStatusPublisher buildMessage: message(failureMsg: githubPRMessage('build failed.'), successMsg: githubPRMessage('build succeeded.')), errorHandler: statusOnPublisherError('FAILURE'), statusMsg: githubPRMessage('Build #${BUILD_NUMBER} ended'), statusVerifier: allowRunOnStatus('SUCCESS'), unstableAs: 'FAILURE'
Jenkins ver. 2.187 GitHub Integration Plugin 0.2.6
Same issue for me Jenkins: 2.176.3 GitHub Integration Plugin: 0.2.6
There is any update with the issue, I am failing on the same thing
githubPRStatusPublisher buildMessage: message(failureMsg: githubPRMessage('build failed.'), successMsg: githubPRMessage('build succeeded.')), errorHandler: statusOnPublisherError('FAILURE'), statusMsg: githubPRMessage('Build #${BUILD_NUMBER} ended'), statusVerifier: allowRunOnStatus('SUCCESS'), unstableAs: 'FAILURE'Jenkins ver. 2.187 GitHub Integration Plugin 0.2.6
maybe it late :) githubPRStatusPublisher have to put in post section. ex:
post {
always{
githubPRStatusPublisher buildMessage: message(failureMsg: githubPRMessage('Can\'t set status; build failed.'), successMsg: githubPRMessage('Can\'t set status; build succeeded.')), statusMsg: githubPRMessage('${GITHUB_PR_COND_REF} run ended'), statusVerifier: allowRunOnStatus('SUCCESS'), errorHandler: statusOnPublisherError('FAILURE'), unstableAs: 'FAILURE'
}
}