openshift / jenkins-plugin

Apache License 2.0
81 stars 50 forks source link

java.lang.NullPointerException during build #35

Closed livelace closed 8 years ago

livelace commented 8 years ago

I used pre-release version of plugin - https://github.com/openshift/jenkins-plugin/issues/34#issuecomment-210033672

But build continued to work in Openshift.

Started by user admin Building in workspace /var/lib/jenkins/workspace/images/testing-11.0-drweb-dss-opensuse

Starting the "Trigger OpenShift Build" step with build config "testing-11.0-drweb-dss-opensuse" from the project "images". Started build "testing-11.0-drweb-dss-opensuse-11" and waiting for build completion ... ERROR: Build step failed with exception java.lang.NullPointerException at com.openshift.jenkins.plugins.pipeline.OpenShiftBuilder.coreLogic(OpenShiftBuilder.java:276) at com.openshift.jenkins.plugins.pipeline.IOpenShiftPlugin.doItCore(IOpenShiftPlugin.java:123) at com.openshift.jenkins.plugins.pipeline.IOpenShiftPlugin.doIt(IOpenShiftPlugin.java:134) at com.openshift.jenkins.plugins.pipeline.OpenShiftBaseStep.perform(OpenShiftBaseStep.java:85) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782) at hudson.model.Build$BuildExecution.build(Build.java:205) at hudson.model.Build$BuildExecution.doRun(Build.java:162) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534) at hudson.model.Run.execute(Run.java:1738) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) Build step 'Trigger OpenShift Build' marked build as failure Finished: FAILURE

gabemontero commented 8 years ago

oops ... not sure what happened ... I'll take a look in a bit

gabemontero commented 8 years ago

hmmm ... I wonder, was the job you ran the build from created before you installed the new version of the plugin?

Typically, for fields not explicitly set Jenkins has been passing in empty strings. But if the job was created prior to a new field being added, Jenkins may pass in a null in that case.

gabemontero commented 8 years ago

Yep, I was able to reproduce this locally and verify my theory. Interesting side effect, which will occur whenever I add a new plugin field in the future.

I'll need to make a more generic, pervasive change on the assumptions build steps make on what Jenkins passes in.

livelace commented 8 years ago

I will try to reproduce this problem (and maybe other), but at now - it is first case. I have ten jobs, I will set it for executions for whole weekend.

gabemontero commented 8 years ago

Based on my local reproduction / confirmation of my theory, I've created a new pre-release version of the plugin stored here that is based on https://github.com/openshift/jenkins-plugin/commit/98c399a828bc36b72e4659542384064284fc66c0.

Closing this issue out - we can reopen / open issues for additional finds as they come up.

livelace commented 8 years ago

It was very fast :)