Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,658
Community Members
 
Community Events
176
Community Groups

Assign fixVersion through automation based on regex

Hi 

We have a project where versions are named based on a name scheme that makes them predictable. Like "PROJECT NAME 0.0.1"

I would like to create a rule that edits an issue and assigns a specific version based on a regular expression. 

Is it possbile to use a regular expression in the fixVersion field to choose a specific version based on its name?

Please see attached screenshot, where I tried to add some "pseudocode" to the fixVersions field to give an idea of how I envision the regular expression to be used. 

Screenshot 2022-05-04 at 11.16.33.png

 

Thank you in advance for your help!

4 answers

1 accepted

In ended up using a big workaround. In case another person finds this thread I will describe the gist of the workaround here: 

Since I never release something which has no issues. I decided to use the lookup action in the Jira automation. That way I can lookup and find issues with the version. And since JQL fixVersion supports wildcards I can do what I want. 

The lookup I make looks like this: `fixVersion ~ "MY VERSION PREFIX*"` 
Then I can access the name of the version from the next action by using: `{{lookupIssues.get(0).fixVersions.get(0).name}}`

And that will contain the name of the release. And I can use that as a name to release that specific release. 

I ended up solving this with a work around.  It's not a perfect solution but it works. Im describing it here in case anybody stumbles upon the thread in search of a solution to a similar problem. 

I realised that I never want to release a version that does not have any tickets. And therefore I could use JQL lookup to find all issues with a specific version name. Since JQL lookup for fixVersion can contain wildcards that will make it possible for me to find the release name. 

So in my automation i made this lookup `fixVersion ~ "MY VERSION PREFIX*"`

And from the next step in the automation I can therefore get the name like this: 
`{{lookupIssues.get(0).fixVersions.get(0).name}}`. And I can use that name to trigger the release



0 votes

Hi @Graunephar 

Thanks! I thought that the {{project}} smart value was only available with the Project Created trigger.

For your question, I believe you will need to use smart value, list filtering to match on the name and then grab the id value:

{{#project.versions}}{{#if(exists(name.match("(yourRegularExpression)")))}}{{id}}{{/}}{{/}}

If it is possible for multiple matches, you may want to put this into a created variable first and then perform some conditional tests.

Kind regards,
Bill

Hi @Bill Sheboy 

Thank you for your help!

Just for clarification (in case anybody stumbles upon this in the future) my example was just something I made up in order to illustrate the problem. 



I tried your solution, However it seems that I cannot add your expression to the field. It keeps deleting the content, and there are no way of saving. Seems like the field will only accept concrete names of versions. 

Do you have any idea if there is something else I can do to use the regular expression?

To use a smart value expression like that in an edit, please try:

  • typing (or pasting) in the expression
  • it will then appear below the field
  • select the value which appears...
  • and then it will save for usage
Like Daniel Graungaard likes this

Hi @Bill Sheboy


Sorry for the late reply. 


I tried you solution a couple of times now, and when I copy it into the field in Jira the dropdown just say "No options" and there is nothing I can choose. (see screenshot below)

 

Screenshot 2022-09-03 at 23.32.15.png

I tried putting the regex in as many formats as I could think of. But I just cannot seem to find the format that the dropdown will accept. 

Can you point me in the right direction? 

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events