Bug 1397753

Summary: Failed to start build from a previous build using "Trigger OpenShift Build" jenkins dsl step
Product: OpenShift Container Platform Reporter: Dongbo Yan <dyan>
Component: ImageStreamsAssignee: Gabe Montero <gmontero>
Status: CLOSED CURRENTRELEASE QA Contact: Wang Haoran <haowang>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.4.0CC: aos-bugs, jokerman, mmccomas, tdawson
Target Milestone: ---Keywords: Regression, Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: NullPointerException when accessing BuildConfig that was not previously retrieved Consequence: jenkins-plugin trigger openshift build of previous build failed Fix: retrieve build config, avoid NullPointerException Result: jenkins-plugin trigger openshift build of previous build works again
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-16 21:03:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Dongbo Yan 2016-11-23 10:13:09 UTC
Description of problem:
Failed to start build from a previous build using "Trigger OpenShift Build" jenkins dsl step

Version-Release number of selected component (if applicable):
brew-pulp.../openshift3/jenkins-1-rhel7   latest              9edb7f9e5157   
brew-pulp.../openshift3/jenkins-2-rhel7   latest              b5b09fbedfc0 
openshift-login	0.9
openshift-pipeline	1.0.36
openshift-sync	0.0.17

openshift v3.4.0.28+dfe3a66
kubernetes v1.4.0+776c994
etcd 3.1.0-rc.0

How reproducible:
Always

Steps to Reproduce:
1.Setup jenkins server and generate application under project
 $ oc new-app https://raw.githubusercontent.com/openshift/origin/master/examples/jenkins/pipeline/samplepipeline.json
 $ oc start-build sample-pipeline
2.wait nodejs-mongodb-example-1 build complete, create pipeline job, configure pipeline scripts
node{
    openshiftBuild bldCfg: 'nodejs-mongodb-example', buildName: 'nodejs-mongodb-example-1', showBuildLogs: 'true', verbose: 'true'
}
3.

Actual results:
Jenkins job failed, cannot start build from previous build

Expected results:
start build from previous build successfully

Additional info:
Starting the "Trigger OpenShift Build" step with build config "nodejs-mongodb-example" from the project "dyanv2".

OpenShiftBuilder logger follow true

OpenShiftBuilder build config retrieved null buildName nodejs-mongodb-example-6
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.lang.NullPointerException
	at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftBuilder.coreLogic(IOpenShiftBuilder.java:233)
	at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPlugin.doItCore(IOpenShiftPlugin.java:305)
	at com.openshift.jenkins.plugins.pipeline.dsl.OpenShiftBuilderExecution.run(OpenShiftBuilderExecution.java:42)
	at com.openshift.jenkins.plugins.pipeline.dsl.OpenShiftBuilderExecution.run(OpenShiftBuilderExecution.java:18)
	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:52)
	at hudson.security.ACL.impersonate(ACL.java:221)
	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:49)
	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)
Finished: FAILURE

Comment 1 Gabe Montero 2016-11-23 17:02:26 UTC
This was introduced when I made the change to allow for the triggering of jenkins strategy builds earlier this week.

Another extended test candidate.

Comment 2 Gabe Montero 2016-11-23 17:49:31 UTC
Commit https://github.com/openshift/jenkins-plugin/commit/6a6cf1d531e73956efbfa7f12bbff1e6b777df93 addresses the NPE in the plugin.

I'll move the bug to QA once the plugin version and images are updated.

Comment 3 Gabe Montero 2016-11-28 15:24:56 UTC
Jenkins rhel image on brew-pulp now has v1.0.37 of the plugin, which includes the fix for this.

Comment 4 Dongbo Yan 2016-11-29 08:01:00 UTC
Test with
brew-pulp.../openshift3/jenkins-1-rhel7          bdda1c3ed6fd  
brew-pulp.../openshift3/jenkins-2-rhel7          40ed5bbd7488
openshift-login	0.9
openshift-pipeline	1.0.37
openshift-sync	0.1.5

openshift v3.4.0.30+e10cc28
kubernetes v1.4.0+776c994
etcd 3.1.0-rc.0

Comment 5 Troy Dawson 2017-02-16 21:03:32 UTC
This bug was fixed with the latest OCP 3.4.0 that is already released.