]
Barak Korren updated OVIRT-1845:
--------------------------------
Epic Link: OVIRT-400
Removing build jobs makes change-queue fail with an exception
--------------------------------------------------------------
Key: OVIRT-1845
URL:
https://ovirt-jira.atlassian.net/browse/OVIRT-1845
Project: oVirt - virtualization made easy
Issue Type: Bug
Components: Change Queue
Reporter: Barak Korren
Assignee: infra
Priority: Highest
When changes are added to the change queue, it records the build jobs that build
artifacts for changed code.
If the build jobs are removed between the time the change is added to the queue and the
time a tested jobs including that change is started, the code checking for completion of
the build jobs would fail with an exception looking like the following:
{code}
java.lang.NullPointerException: Cannot invoke method getBuild() on null object
at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:91)
at
org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:35)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at
org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:52)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at Script1$_all_builds_done_closure4.doCall(Script1.groovy:265)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at
org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
{code}
'{{Script1}}' in this stack trace refers to our
'{{change-queue-tester.groovy}}' script. Relevant code section is the following:
{code}
@NonCPS
def all_builds_done(builds) {
return !builds.any {
if(Jenkins.instance.getItem(it.job_name).getBuild(it.build_id).isBuilding()) {
print("${it.job_name} (${it.build_id}) still building")
return true
}
return false
}
}
{code}
The issue it with not checking for '{{null}}' return from the
'{{Jenkins.instance.getItem(it.job_name)}}' funcntion call.
We should probably check for '{{null}}' there and just ignore it. Similar check
will probably be needed in other places in the code like for example when composing the
'{{extra-sources}}' file from the build job URLs.