ThaDon
ThaDon

Reputation: 8068

How to prevent Jenkins from resuming an aborted job

I had aborted a job by clicking the [x] button next to it's name in the Build Executor Status panel of Jenkins, yet the job is still present and waiting.

enter image description here

Even when I restart Jenkins it will resume building. When I take a look at the console I see:

Sending interrupt signal to process Click here to forcibly terminate running steps java.io.IOException: Aborting build at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247) at Script1.run(Script1.groovy:1) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:585) [SNIP]

Finished: ABORTED Resuming build at Tue Oct 25 14:56:36 CDT 2016 after Jenkins restart

I believe this version of my Pipeline script also included an "Input" block, it's possible the job was aborted as it was waiting for Input if that makes a difference

Upvotes: 4

Views: 2414

Answers (1)

Peter McNab
Peter McNab

Reputation: 1101

I clean these up by going Manage Jenkins -> Script Console and then putting in code like this:

Jenkins.instance.getItemByFullName( "tpr-ereg") .getBuildByNumber(24). finish(hudson.model.Result.ABORTED, new java.io.IOException("Aborting build"));

NOTE: the above may need to be all on one line in the Script Console

Upvotes: 3

Related Questions