How to trigger a Jenkins job from a status change in Jira How to trigger a Jenkins job from a status change in Jira jenkins jenkins

How to trigger a Jenkins job from a status change in Jira


So, basicly there are webhooks in jira (https://developer.atlassian.com/jiradev/jira-architecture/webhooks). With it you can configure it to trigger specific url on issue status change. The specific url should be jenkins API, for example for triggering a build you should call an external url like (if you are building with parameters): http://server/job/myjob/buildWithParameters?token=TOKEN&PARAMETER=Value

Some more info https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API


I have written a Jenkins plugin that supports JIRA status change trigger: jira-trigger-plugin.

This plugin also injects an environment variable of JIRA_ISSUE_KEY, so you can utilise this information to publish your result back to JIRA e.g. using REST API.


Please follow as mentioned below:

GIT:

You can set the web hooks for git/ bitbucket /stash on commit which inturn should change the state of task in JIRA.

JIRA:

Once you in JIRA. define the workflow for your task.In this particular workflow you can set a post-function where the web hook should be configured. In this configuration of webhook in events define JQL as below:

status CHANGED FROM "To Do" TO "ready to test".

In the same mention the job that needs to be fired in the URL section.