kick off Jenkins builds from Jira

Hi,

I'm looking for a way to kick off remote Jenkins builds from Jira. The idea is for the build to be triggered by a Jira workflow status transition. Is this possible? How best to go about it?

After rooting around here a few days I've gotten the idea hat a groovy script running in the ScriptRunner plugin and set up as a transition post-function might do the job. Will this work? Is there a better way?

I'm thinking the script would send a RESTful POST to Jenkins to kick off the build. It would have to get some data out of the issue (the one whose transition called it) first though, which I'm guessing would involve the Jira (java) API?

Just looking for some high-level guidance here, total Jira newbie.

thanks!

1 answer

0 votes
Timothy Chin Community Champion Nov 20, 2013

I believe that Jenkins has a REST API. If you can figure that part out, you can use JIRA webhooks (https://developer.atlassian.com/display/JIRADEV/JIRA+Webhooks+Overview) to trigger or call those REST API.

Yes, Webhooks would seem to be the answer. Unfortunately, HTTP Basic Auth is broken in Webhooks (has been since inception) so you can only do anonymous POSTs that way, which won't cut it in our environment. What I'm really looking for is a workaround to the broken Webhooks problem, ScriptRunner looks like a possibility but I'm not sure its the best one.

https://jira.atlassian.com/browse/JRA-31953

Came across this looking for a solution to the same problem. What I did as a quick workaround was setup a flask application that accepts the Jira Webhook post, grabs the details of the ticket needed to run the Jenkins build, and sends a post to the Jenkins API to run the build. It works really well - I even have Jenkins sending back the build ID and periodic status updates as the build goes through the pipe line (readiness check, build, db updates, deployment, build complete).

can u please suggest me the configuration , please

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,167 views 13 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot