Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to run a job in jenkins when user comment in jira

Ashish Ahuja
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 21, 2019

How to run a job in Jenkins when user comment in Jira

1 answer

1 accepted

0 votes
Answer accepted
Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 22, 2019

Hello Ashish,

You can use JIRA Webhooks to properly notify a script to trigger the build creation in Jenkins when an issue is commented:

Comment webhooks

- created (comment_created)

- updated (comment_updated)

- deleted (comment_deleted)

You can check more information about webhooks in the documentation below:

JIRA Cloud Webhooks

Additionally, the app below provide you with the ability to create builds directly from JIRA, so you would only need to create a script to receive Jira webhook and trigger the creation of the build:

Jenkins Integration from JIRA

Let me know if this information helps.

Ashish Ahuja
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 25, 2019

Hi Petter,

Thanks for the above information, it was very useful.

I am able to see Jenkin's job in Jira but how do I trigger those jobs through Jira.

Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 26, 2019

Hello Ashish,

You can trigger the Jenkins builds by simply clicking to do it in the Issue view, as displayed in the screenshot below:

Screen Shot 2019-08-26 at 10.38.02.png

However, per your description, I believe you want it to be triggered automatically upon an issue comment. Since the plugin does not provide this kind of functionality, you will need to create a script to properly trigger those jobs, using the REST API of Jenkins and JIRA Webhooks, as mentioned before:

- Jenkins API

JIRA Cloud Webhooks

In fact, you will need some dev skills to accomplish that. I must confess that I'm not a Jenkins specialist, so you will need to dig a little bit further in Jenkins REST API to develop the Script.

Let me know if there is anything else I can help.

Suggest an answer

Log in or Sign up to answer