Jira/Stash linkage

Scott Hung April 8, 2013

Hello,

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.

Thanks!
Scott

2 answers

1 accepted

0 votes
Answer accepted
Scott Hung April 17, 2013

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
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 9, 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.

Deleted user April 9, 2013

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?

Thanks

Scott Hung April 9, 2013

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
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 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