HUDSON: How to stop hudson from the command line?

I need to force stop the creation of Hudson on the remote server. Is there a command / API for this?

for ex: to start a new build we can do: - HUDSON_URL / job / JOBNAME / build

looking for a similar API to stop the build.

+8
hudson hudson-api
source share
2 answers

You should be able to make an http request

http://HUDSON_URL/job/JOBNAME/BUILDNUMBER/stop

and you can make an xpath request to get the build number

http://HUDSON_URL/job/JOBNAME/api/xml?xpath=//lastBuild/number/text()

There may be a way to insert lastBuild or lastBuild instead of BUILDNUMBER, but if not, you can just use the 2 http gets.

+10
source share

From the answer above (above), the comment of @girishs and some of my work in the Windows environment (maybe Linux could use wget instead of curl , not tested):

 curl --request POST -u <USER>:<PASS> "%JENKINS_URL%/job/%JOB_NAME%/lastBuild/stop" 

... which stops the most recent build without any editing in the future. All you need is your user / pass command.

+3
source share

All Articles