Integrating with custom JIRA issue key

Troubleshooting JIRA Integration

On this page

Symptoms

JIRA has a UI to help specify a custom issue key format. When integrating with Stash, these custom JIRA issue keys are not recognized by Stash and hence commits are not linked to the JIRA issues.

Cause

Stash passes commit messages through a regex pattern to identify and create links. The custom JIRA issue key format will not work with the default pattern that Stash is shipped with:

((?<!([A-Z]{1,10})-?)[A-Z]+-\d+)

Resolution


 Follow the steps below to modify the regex pattern:

1) Shut down Stash.

2) Edit the contents of the <Stash installation directory>/bin/setenv.sh or <Stash installation directory>/bin/setenv.bat (depending upon your OS) and add the modified regex to the variable JVM_SUPPORT_RECOMMENDED_ARGS.

3) Save the file.

4) Remove the contents of the following folder:

Version Folder location
Up to 2.10.x <STASH_HOME>/caches/idx-snapshots
2.11+ <STASH_HOME>/data/snapshots
3.2+ <STASH_HOME>/shared/data/snapshots

 

5) Restart Stash.

6) Push to the repository with the JIRA issue key in the commit message to force a reindex of the data.

 

For example, to match JIRA keys such as C001-1 or ABC123-1, set the variable as follows:

Pre 2.8:

JVM_SUPPORT_RECOMMENDED_ARGS="-Dstash.jira.key.pattern=\"((?<!([A-Z0-9]{1,10})-?)[A-Z0-9]+-\d+)\""

 

 2.8+

JVM_SUPPORT_RECOMMENDED_ARGS="-Dintegration.jira.key.pattern=\"((?<!([A-Z0-9]{1,10})-?)[A-Z0-9]+-\d+)\""

 

If the parameter is set correctly the following line will be logged in the <STASH_HOME>/log/atlassian-stash.log:

2012-10-23 13:43:16,805 INFO  [main]  c.a.s.i.jira.idx.JiraKeyIndexer Using custom JIRA key pattern: ((?<!([A-Z0-9]{1,10})-?)[A-Z0-9]+-\d+)



Last modified on Jan 30, 2015

Was this helpful?

Yes
No
Provide feedback about this article

Not finding the help you need?

Ask the community

Powered by Confluence and Scroll Viewport.