1

We are using webhooks to trigger a Jenkins jobs when merge request created in Gitlab project. If any interruption occurs when a Jenkins job is running, should abort the job.

Consider the following cases too to abort the Jenkins job.

  1. Slave disconnected from Jenkins master machine

  2. Jenkins server restarted

Is there any plugin available to abort the job on interruption?

Karthi
  • 575
  • 2
  • 10
  • 29
christo
  • 129
  • 1
  • 2
  • 13

1 Answers1

0
  1. When a slave is disconnected from server , build will fail as no executor will be available for the job to continue further , possible error will "NO JDK found "

  2. When jenkins is restarted it will stop all jobs in execution and queue.

AFAIK there is no perfect matched plugin for your requirement , reason being Java only allows threads to be interrupted at a set of fixed locations, depending on how a build hangs, the abort operation might not take effect.

But you can try some rest api's https://wiki.jenkins.io/display/JENKINS/Aborting+a+build

Or abort a job on some conditions :

https://wiki.jenkins.io/display/JENKINS/Build-timeout+Plugin

Some more ref :

How to stop an unstoppable zombie job on Jenkins without restarting the server?

prudviraj
  • 3,634
  • 2
  • 16
  • 22
  • I'd say that 2) is wrong for pipelines. [CPS](https://wiki.jenkins.io/display/JENKINS/Pipeline+Groovy+Plugin) is the magic sauce here. – StephenKing Sep 08 '17 at 13:09