Create Bitbucket ScriptRunner Repository Level Variables

Tim Razik July 31, 2017

I am working on a simple plugin that can capture a PullRequestMergeEvent using Adaptavist ScriptRunner.  I haven't coded it yet but it looks like it will be an easy Event hook that triggers an http post event to our Jenkins or Bamboo instance.

I would like to write the script in a generic way so that I can use different values for our Jenkins/Bamboo instance depending on the repository.

Instead of coding an if/else block, is there a way to set custom properties or global varables at a repository level in bitbucket?

In an older plugin we coded a UI to gather some values but I was hoping that there was something out of the box where I can define things at a repostiroty lievel such as

 

jenkinsurl=myjenkins.myco.com
ci-job-name=some job name
etc...

1 answer

0 votes
Daniel Yelamos [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 3, 2017

Hi Tim.

If you have access to your server, you could create a groovy file that contains your variables. For example an enum or whatever suits you.

When you need it, you can simply import it. So long as it is in your script roots, it should work.

Cheers!

DYelamos

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events