Jira/Stash linkage


I am an Atlassian-newbie and am working on a Jira/Stash/Confluence conversion from Bugzilla/CVS/Mediawiki. I imported the Bugzilla database & CVS repo and wish to preserve history by linking the newly ported Git commits to the newly ported Jira issues. Commit comments start with "Bug xxx:" which match Jira's External issue ID xxx. Is there a way I can script/automate this task?

This link is similar but talks about updating stash for JIRA keys.


2 answers

1 accepted

0 votes
Accepted answer

I ended up using git's filter-branch command to insert the JIRA issues into the commit message . First step extracts, from the JIRA database, a text file listing JIRA to Bugzilla issues. Executed a ruby script via filter-branch with a big regex that augments bugzilla bug IDs with JIRA issue IDs. It's not a perfect conversion because commit messages are a free text field, but it gave us a huge head start!

The changeset indexing plugin sounds like it enables similar capability, but it's a learning curve I wasn't ready for...

1 vote
Seb Ruiz Atlassian Team Apr 09, 2013

You can change the JIRA regular expression to also look for "Bug xxx:". You'll have to do some regular expression wizardry but it shouldn't be impossible. The question you have linked to shows you which property to set.

Edit: Unfortunately I was a little to rushed. Since your JIRA issue won't have the "BUG" project, you'd probably need to set up your Apache config to handle redirects as follows:

Stash sees "Bug 123" in a commit message, think it's a JIRA key (as per your regular expression)

Stash links Bug 123 to http://jira/browse/BUG-123

Apache rewrites this URL to http://jira/browse/PROJECT-123

Of course, this relies on the fact that your bugzilla ids are identical to JIRA issue ids.

Hi @Seb Ruiz

I think It's not convenience to add jira id every time when I want to commit the code.

I have to break and visit the jira page to get id w
hen I was going to commit,

Shall we also add the jira id into the pull request?

If commit have not contain any jira id, the stash can also display the jira id which in the pull request.

Is that possible? And what's your opinion?


Appreciate the help. Unfortunately, I can't find a way to get the JIRA & Bugzilla #s to match. Fortunately, JIRA has the external ID field which exactly matches the bugzilla number so I believe some custom scripting could be used to match Stash commits to the JIRA issue. If you know of an easier way I'd love to hear about it! In the meantime, I'll be doing a lot of searching & reading...

Seb Ruiz Atlassian Team Apr 10, 2013

@zane - Pull requests are only currently linked to jira issues via the commits which comprise the pull request.

@Scott - I think the only way you'd be able to solve this currently is by writing your own changeset indexing plugin in Stash which does some smarts to determine which JIRA issue to link to. Have a look at our docs at https://developer.atlassian.com/stash/docs/latest/index.html and specifically https://developer.atlassian.com/stash/docs/latest/reference/plugin-module-types/changeset-indexer.html

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,018 views 4 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you