Search code examples
jenkinsjenkins-pluginsjirajira-plugin

How to trigger a Jenkins job from an approval of a Jira task


I'm looking for a method to trigger remote Jenkins job based on Jira workflow status. The idea is to create a Jenkins job which is to be triggered based on Project Manager's approval.

When task gets approval status then Jenkins should trigger the job in project.

Note: I have created a webhook in Jira and configured required plugins in Jenkins.


Solution

  • If I Understood correctly the question, you want to trigger the Jenkins Job when the Jira Item(task/ticket) is in particular state(e.g. Approved, In-progress).

    You possibly need to have following Plugins:

    1. JIRA
    2. JIRA Pipeline Steps
    3. JIRA Trigger Plugin
    4. JIRA ext-plugin

    Before creating a job which will triggered based on Jira Item status, you need to have JIRA webhook integration.

    enter image description here

    The KEY* is the TICKET PATTERN required to integrate with Jenkins. Please find a link which explains a simple use case in here

    While creating jenkins job, you will get under category 'Build Trigger' additional option 'Build when issue is updated in JIRA'. After this be keen to update JQL Filter as per your need.