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

Assign fixVersion through automation based on regex

Graunephar May 4, 2022

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

0 votes
Answer accepted
Daniel Graungaard September 6, 2022

d

1 vote
Daniel Graungaard September 6, 2022

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. 

1 vote
Daniel Graungaard September 6, 2022

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
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.
May 4, 2022

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

Graunephar May 10, 2022

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?

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.
May 10, 2022

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
Daniel Graungaard September 3, 2022

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
AUG Leaders

Atlassian Community Events