It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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!

2 answers

0 votes
Timothy Chin Community Leader 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

0 votes
Dario Atlassian Team Sep 26, 2019

I know the thread is a bit outdated but maybe it can be useful to other people:

 

There is also a video on youtube showing how this works:

 

I hope this helps.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

The add-in you’ve been waiting for: Jira Cloud for Excel 🙌

Introducing Jira Cloud for Excel Here at the product integrations team at Atlassian, we are thrilled to announce the new Jira Cloud for Excel add-in! This add-in lets you export Jira data directly ...

978 views 11 25
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you