Stop Jenkins build for specific job via REST - jenkins

How can I stop Jenkins build for specific job?
I am looking for REST API
I did not find such in documentation
EDIT
The tricky part is that I need to fetch the running build ID somehow so I can send
http://HUDSON_URL/job/JOBNAME/BUILDNUMBER/stop

Related

Post commit deliver hook for RTC

I have a working Jenkins setup that can pull source code from RTC (Jazz server) and build etc. I can run this Jenkins job on demand or schedule to run at a random interval. However, now I am exploring as to how I can run this job only on detecting a change in the repository (e.g. new change set is delivered). I dont want to use the polling mechanism that Jenkins provide and I want RTC's post commit process to call my Jenkins job remotely.
Please can anyone guide me how I do it? Thank you.,

How to trigger a Jenkins Job from outside and receive the status of build

I need to trigger a Job from another Scheduler and want to receive the status of the triggered Job after it finishes.
Sure it would be possible to create a status file or such, but it would be convenient to trigger the Job from a script or per httpRequest and wait for some kind of exit or return code.
Is that possible?
For this, you have to use Build Authorization Token Root Jenkins plugin
It will allow you to run Jenkins build remotely.
Check this image
Please check my article : https://medium.com/appgambit/trigger-jenkins-job-from-slack-5b07b6131e25
But yes you can skip slack integration and just use API for triggering particular job.
Or if you want to run your job after another job is complete or success you have to use "Build after other projects are built"
Build after other projects are built

Jenkins call http api after a build has completed

Context
I use poll policy to get the result of a build. But I want jenkins automatically push the result to me.
How to configure a job to call a http api after its build has completed?
For example, after a build has completed, jenkins call https://{myserver}/api/v1/jenkinsPostBuildCallback?jobName=name&buildNumber=1&result=Failed
Current Attempt
I want to achieve this using jenkins plugins, but I find no plugin that meet my requirement.
Maybe I should develop a custom jenkins plugin?
In the post build select execute shell command and add a curl command to call your http api.

How to trigger build in jenkins through command in HipChat

I need to trigger build in jenkins which is in cloud (AZURE) by a command passed in HipChat Integration.
The thing that you are looking for is often referred to as ChatOps. There are couple of tools that allow you to do such thing, which is effectively a program joining the chat room (the "bot") and waiting for commands.
The list of tools includes Hubot and StackStorm, which then call Jenkins API to trigger the job. An adapter for StackStorm exists here.

Can Jenkins detect when a new build is available on a Bamboo server?

Can Jenkins detect when a new build is available on a Bamboo server?
What I want is to create a Jenkins job that checks a Bamboo server for a new build. I want this job to run once per hour.
Then, other tests that I have on that Jenkins server will rely on that check passing in order for them to kick off.
If this is possible, what is the usual way of doing this? The Bamboo server is internal and does not need authentication to see status of builds or get build resources.
If there is no plugin for this, I do see a RSS feed at this URI: /rss/createAllBuildsRssFeed.action?feedType=rssAll&buildKey=RELEASE . What method would other Jenkins administrators use to read this feed?
I figured out the answer myself. I wrote a Gradle unit test to run in Jenkins that can read the RSS feed in Bamboo.
The real way to do it though, which didn't answer my question, is to add a post-build hook to either Subverison or Bamboo to send a HTTP get request to Jenkins, which notifies a job to run.

Resources