[JIRA] (JENKINS-39011) Nullpointer: Cannot get property 'stages' on null object

5 views
Skip to first unread message

p.leibiger@codecraft.de (JIRA)

unread,
Oct 16, 2016, 6:37:01 AM10/16/16
to jenkinsc...@googlegroups.com
Peter Leibiger created an issue
 
Jenkins / Bug JENKINS-39011
Nullpointer: Cannot get property 'stages' on null object
Issue Type: Bug Bug
Assignee: Andrew Bayer
Components: pipeline-model-definition-plugin
Created: 2016/Oct/16 10:36 AM
Priority: Minor Minor
Reporter: Peter Leibiger

Up to version 0.3 pipeline could be wrapped by timestamps from the timestamps plugin which was really neat. This doesn't work anymore and causes a Nullpointer.

java.lang.NullPointerException: Cannot get property 'stages' on null object
	at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:60)
	at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:172)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:302)
	at org.jenkinsci.plugins.pipeline.modeldefinition.Utils.attachExecutionModel(Utils.groovy:202)
	at org.jenkinsci.plugins.pipeline.modeldefinition.Utils$attachExecutionModel$4.call(Unknown Source)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:16)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(jar:file:/var/jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:51)
	at WorkflowScript.run(WorkflowScript:7)
	at ___cps.transform___(Native Method)
	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:48)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
	at sun.reflect.GeneratedMethodAccessor347.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
	at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
	at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
	at sun.reflect.GeneratedMethodAccessor349.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
	at com.cloudbees.groovy.cps.Next.step(Next.java:58)
	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:163)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:324)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224)
	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	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)
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

andrew.bayer@gmail.com (JIRA)

unread,
Oct 20, 2016, 5:38:01 AM10/20/16
to jenkinsc...@googlegroups.com
Andrew Bayer commented on Bug JENKINS-39011
 
Re: Nullpointer: Cannot get property 'stages' on null object

Interesting - it makes sense that it wouldn't work (if you've got the pipeline step in your Pipeline, other steps won't work outside it) but it does need error reporting. And we need https://issues.jenkins-ci.org/browse/JENKINS-37823 so that you can actually use timestamper. =)

andrew.bayer@gmail.com (JIRA)

unread,
Oct 20, 2016, 8:00:01 AM10/20/16
to jenkinsc...@googlegroups.com
Andrew Bayer started work on Bug JENKINS-39011
 
Change By: Andrew Bayer
Status: Open In Progress

andrew.bayer@gmail.com (JIRA)

unread,
Oct 20, 2016, 10:06:07 AM10/20/16
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Oct 20, 2016, 10:07:01 AM10/20/16
to jenkinsc...@googlegroups.com
 
Re: Nullpointer: Cannot get property 'stages' on null object

PR up - https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/33 - this doesn't allow the previous use case, but it does start catching this at parse-time, as it should have previously. I'll get moving on the wrapper addition ASAP as well.

scm_issue_link@java.net (JIRA)

unread,
Oct 24, 2016, 5:59:05 AM10/24/16
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Andrew Bayer
Path:
pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy
pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java
pipeline-model-definition/src/test/resources/errors/pipelineStepWithinOtherBlocksFailure.groovy
http://jenkins-ci.org/commit/pipeline-model-definition-plugin/4c9cb6df95d606dc02bf747d91f6e0e00f2ee4f6
Log:
Merge pull request #33 from abayer/jenkins-39011

[FIXED JENKINS-39011] Error out at parse time when pipeline step is n…

Compare: https://github.com/jenkinsci/pipeline-model-definition-plugin/compare/abbde740b9b6...4c9cb6df95d6

scm_issue_link@java.net (JIRA)

unread,
Oct 24, 2016, 5:59:06 AM10/24/16
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Andrew Bayer
Path:
pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy
pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java
pipeline-model-definition/src/test/resources/errors/pipelineStepWithinOtherBlocksFailure.groovy

http://jenkins-ci.org/commit/pipeline-model-definition-plugin/f25d40a2a5ffe0469ce80b070610d07fcdd3bb2a
Log:
[FIXED JENKINS-39011] Error out at parse time when pipeline step is nested.

We don't want to support nesting the pipeline step within other blocks

  • until JENKINS-38152, we never noticed that this was actually
    possible, since the parse-time validation just ignored any Jenkinsfile
    without a root-level pipeline step, but with JENKINS-38152, we not
    only do another parse round but need to grab the stages from the model
    to attach to the run, so we hit an NPE when there's a pipeline step
    nested under other blocks.

So - this will now catch when the pipeline step is nested within
another block and give an error message at parse-time, rather than
NPEing at runtime. There is a valid use case for wanting to wrap the
entire build in something like a timeout or timestamper, but we're
going to address that with JENKINS-37823.

andrew.bayer@gmail.com (JIRA)

unread,
Oct 24, 2016, 6:00:02 AM10/24/16
to jenkinsc...@googlegroups.com
 

Merged, will be released in 0.5.

Change By: Andrew Bayer
Status: In Review Resolved
Resolution: Fixed

p.leibiger@codecraft.de (JIRA)

unread,
Nov 27, 2016, 11:02:04 AM11/27/16
to jenkinsc...@googlegroups.com
Peter Leibiger commented on Bug JENKINS-39011
 
Re: Nullpointer: Cannot get property 'stages' on null object

I can confirm it is working now by adding

  wrappers {
    timestamps()
  }

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:25:10 PM10/22/19
to jenkinsc...@googlegroups.com
Liam Newman closed an issue as Fixed
 

Bulk closing resolved issues.

Change By: Liam Newman
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages