Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove an unstoppable pipeline job in Jenkins?

I'm using the Pipeline (formerly Workflow) plugin collection for Jenkins. I've somehow managed to create a workflow job on my Jenkins server that I cannot stop. Querying the current stack traces with Thread.getAllStackTraces().keySet().each() { t -> println(t.getName())} does not return any executors in the output matching this job. On top of that, if this is the only live job in the Build Executor Status window, there are no executors listed at all.

Restarting the slave that the job was executing on had no effect. Restarting the Jenkins master server had no effect either. Any thoughts on how I could get rid of this thing?

like image 877
bshacklett Avatar asked Dec 22 '15 16:12

bshacklett


People also ask

How do you abort a pipeline in Jenkins?

You can mark the build as ABORTED, and then use the error step to cause the build to stop: if (! continueBuild) { currentBuild. result = 'ABORTED' error('Stopping early…') }


2 Answers

I was able to stop the job by submitting a POST request to: http://jenkins.fqdn:8080/job/$JobName/branch/$BranchName/8/term (Note the $JobName and $BranchName variables)

I found this URI by doing the following:

  1. Click on the number next to the job to navigate to that exact job.
  2. Click the Console Output link.
  3. Right-Click the "Click here to forcibly terminate running steps" link.
  4. Click the Inspect menu item. (This is in Chrome; adjust this step for your preferred browser)
  5. Copy the URI from inside the Ajax.Request call. E.g.:onclick="new Ajax.Request('http://jenkins.fqdn:8080/job/$JobName/branch/$BranchName/8/term'); false"

For some reason, clicking the Click here to forcibly terminate running steps link didn't actually terminate the job, but submitting a post request manually did. I suspect it's probably just a little bug in the UI code.

like image 135
bshacklett Avatar answered Oct 07 '22 03:10

bshacklett


I've got the same problem today and workaround from the comment above didn't help me as well as sending /kill command instead of /term.

I found working solution here:

  1. OPEN https://your.jenkins.fqdn/script
  2. PUT Jenkins.instance.getItemByFullName("jobName").getBuildByNumber(9).finish(hudson.model.Result.ABORTED, new java.io.IOException("Aborting build"));
  3. PRESS "Run"
like image 24
kivagant Avatar answered Oct 07 '22 05:10

kivagant