The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

How to get Bitbucket variables to use in a groovy template Jira message

Michael Stevens
Contributor
August 20, 2018

I'll start by saying what I am trying to achieve. I want to be able to set up Jira to comment on a Jira issue whenever a Bitbucket pull request is merged that contains that particular issue. I want to set up the comment to contain a message like "This issue was merged from <branch merging from> to <target branch>".

On our Jira server we already have a "Pull Request Merged" trigger and I can create a Post Function on that transition. Which leads me to the JMWE where I can construct the message using groovy templates. I can't see how I can get the Bitbucket variables I need though to complete the message, I can only see Jira variables available to put in the message.

Any help is greatly appreciated.

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Nir Haimov
Community Champion
August 21, 2018

you can use groovy to access Bitbucket data via REST API (with the Jira issue as reference to Bitbucket) and retrieve all the data you want