Search code examples
jenkinsgroovytriggersjirajobs

Jira post action script to get custom values


I have a Jira issue that has different custom fields. I want to trigger a parameterized Jenkins job, after the Jira issue is filled up and moved from Open to In Progress, and the Jenkins job parameters will be each of the field values the Jira issue contains. I was trying to do this with two approaches: - Jira Trigger plugin, but I can't find the way to get the Jira issue custom fields values and neither to use them as parameters to trigger Jenkins job. - Using the post action script on the Jira issue transition, but I'm struggling to know how to get the Jira custom values on the script, to then be used to POST them to Jenkins job


Solution

  • You can use Script Runner plugin for this requirement . https://marketplace.atlassian.com/apps/6820/scriptrunner-for-jira

    This plugin can be used as a listener/post (groovy code) to the desired state transition which will capture the required field values and feed them to Jenkins through API call .