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

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

Suggest an answer

Log in or Sign up to answer