[JIRA] (JENKINS-40307) Not passing threshold to upstream() in pipeline leads to NPEs

1 view
Skip to first unread message

bmerry@ska.ac.za (JIRA)

unread,
Dec 8, 2016, 5:26:01 AM12/8/16
to jenkinsc...@googlegroups.com
Bruce Merry created an issue
 
Jenkins / Bug JENKINS-40307
Not passing threshold to upstream() in pipeline leads to NPEs
Issue Type: Bug Bug
Assignee: Unassigned
Components: workflow-job-plugin
Created: 2016/Dec/08 10:25 AM
Environment: Jenkins 2.7.1 (Docker image)
workflow-job-plugin 2.9.2
Priority: Minor Minor
Reporter: Bruce Merry

When setting up dependencies in a multibranch pipeline, I wrote

properties([
        pipelineTriggers([upstream(upstreamProjects: dependencies.join(','))])
    ])

I had omitted the threshold parameter, assuming that it would default to SUCCESS (and I wasn't sure what to put in anyway due to JENKINS-40304). The dependencies weren't working. I discovered this NPE in the logs:

Dec 08, 2016 11:08:34 AM hudson.model.listeners.RunListener report
WARNING: RunListener failed
java.lang.NullPointerException
        at hudson.model.Result.isBetterOrEqualTo(Result.java:130)
        at jenkins.triggers.ReverseBuildTrigger.shouldTrigger(ReverseBuildTrigger.java:138)
        at jenkins.triggers.ReverseBuildTrigger.access$000(ReverseBuildTrigger.java:88)
        at jenkins.triggers.ReverseBuildTrigger$RunListenerImpl.onCompleted(ReverseBuildTrigger.java:258)
        at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:202)
        at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:582)
        at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1200(WorkflowRun.java:120)
        at org.jenkinsci.plugins.workflow.job.WorkflowRun$GraphL.onNewHead(WorkflowRun.java:865)
        at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:1081)
        at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$3.run(CpsThreadGroup.java:398)
        at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:35)
        at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
        at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
        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:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

From what I can tell, omitting the threshold parameter is causing it to be set to null, leading to the null pointer exception. View Configuration in the GUI didn't reveal any problems, instead showing the threshold as success.

I don't know if there is any way in the Jenkins reflection system to prevent this, but it would be nice if it was possible for the pipeline script to give an error rather than silently inserting properties that cause exceptions, or else to pick a sensible default.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

bmerry@ska.ac.za (JIRA)

unread,
Dec 8, 2016, 5:29:01 AM12/8/16
to jenkinsc...@googlegroups.com
Bruce Merry commented on Bug JENKINS-40307
 
Re: Not passing threshold to upstream() in pipeline leads to NPEs

For anyone arriving here from a search: I found the following script (run in the script console) useful to identify the jobs that had null thresholds:

for (item in Jenkins.instance.allItems) {
  for (entry in item.properties) {
    def value
    try
    {
      value = entry.value;
    }
    catch (IllegalPropertyError) {
      continue;
    }
    if (value instanceof org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty) {
      for (trigger in value.triggers) {
        if (trigger instanceof jenkins.triggers.ReverseBuildTrigger)
          println(item.fullName + " " + trigger.threshold)
      }
    }
  }
}

jglick@cloudbees.com (JIRA)

unread,
Feb 10, 2017, 11:45:01 AM2/10/17
to jenkinsc...@googlegroups.com
Jesse Glick updated an issue
 
Change By: Jesse Glick
Component/s: core
Component/s: workflow-job-plugin
Labels: pipeline robustness
Reply all
Reply to author
Forward
0 new messages