Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I abort a jenkins build

Tags:

jenkins

I start the build process for a project inside Jenkins I am unable to stop it I tried pressing the cross button but it does not stop the build process. How do I kill the build inside Jenkins, The build process is just hanging. I am new to Jenkins btw


2 Answers

You can use the follwoing to kill the process

java -Dhudson.util.ProcessTree.disable=true -jar jenkins.war

follow the link for more details

and if you have started build remotely then you can do the following.

If the build has started, by GET on:

http://<Jenkins_URL>/job/<Job_Name>/<Build_Number>/stop

Will stop/cancel the current build.

If the build has not started, you have the queueItem, then POST on:

http://<Jenkins_URL>/queue/cancelItem?id=<queueItem>

Assume your Jenkins has not been secured, otherwise you need to add ?token=TOKEN to the end of the urls, where TOKEN can be the security token of a user with sufficient privileges to cancel builds.

like image 56
Trikaldarshiii Avatar answered Nov 23 '25 11:11

Trikaldarshiii


As is explained here about Aborting a Jenkins Build, when you click the X (abort link), it sends an OS termination signal. Whether that signal is processed by your underlying process or not depends on how busy that process is and how well it is coded:

  • Waiting for a completion of a child process (for example, maybe the build is running Ant) is an interruption point. That means if the executor was doing that, it gets interrupted instantaneously.
  • Waiting for a computation on a slave is an interruption point.
  • Waiting for file or network I/O is not an interruption point. This often causes the problem where a build appears to be un-abortable. For example, checking out a Subversion repository falls in this category.
  • Normal computation is also not an interruption point.

Read the above link for more information on troubleshooting.

like image 30
Slav Avatar answered Nov 23 '25 12:11

Slav



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!