how to retrieve bitbucket build/deployment/repository tag name in Jira automation setup

kenan xin November 25, 2023

on smart values documentation page Jira smart values - development | Cloud automation Cloud | Atlassian Support : 

{{build.refs}} returns the refs of the build, e.g. [feature/ISSUE-123-some-work, feature/ISSUE-456-more-work]. This is a list of metadata that can be associated with a build. It may contain, for example, branches and tags names.
This value is optional and may be an empty list.

how do i retrieve the tags names / repository tags of the build from {{build.refs}} ?

We are using tags as a trigger for deployments of a mono repo. For examples, 

tag1:   app1_1.1.2_dev

tag2:   app2_1.1.2_dev

 

so tagging a commit  in bitbucket with the tag app1_1.1.2_dev will trigger a deployment of app1 to dev environment. 

 

Now, what we want to do is to setup an automation to automatically transit a ticket if 

1. the ticket is for app1

2. the deployment build is tagged with app1_xxxxxx

Screenshot 2023-11-26 012313.png

how do i retrieve the tags names / repository tags of the build from the deployment's {{build.refs}} ?

 

2 answers

2 votes
Bill Sheboy
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.
November 25, 2023

Hi @kenan xin -- Welcome to the Atlassian Community!

I have not tried that with this smart value, so please experiment to learn if this helps:

The {{build}} smart value is only available with the built-related triggers: Build Successful, Build Failed, or Build Status Changed.  And so the rule will need to use one of those.

Next, I recommend writing {{build.refs}} to the audit log when your rule triggers.  That will show what is in the attribute, and then guide you on what can be parsed out, with list or text functions.

Kind regards,
Bill

kenan xin November 28, 2023

thank you @Bill Sheboy , let me try and update here

Like Bill Sheboy likes this
0 votes
kenan xin November 28, 2023

the value of {{build.refs}} smart value is empty when printing out the value in log after a deployment, any ideas?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events