Jump to content

Recognising JIRA issue keys like //depot/TASK-123 in commit message

jira swarm p4v

  • Please log in to reply
2 replies to this topic

#1 Neil Padgen

Neil Padgen


  • Members
  • PipPip
  • 15 posts

Posted 06 February 2015 - 12:17 PM

I'm evaluating Swarm.  I've got it to link to my JIRA, but it doesn't recognise JIRA issue keys in commit messages where they're prefixed with a slash.

We use task streams named after our JIRA issues (eg //depot/TASK-123).  I'd like to link to JIRA whenever something's copied to the mainline.

The default change description for a commit is along the lines
Copying //depot/TASK-123 to //depot/main

TASK-123 isn't recognised by Swarm as a JIRA issue in this message, so the link isn't added.

I've tried using a form-out trigger to change the message to read "Copying TASK-123 from //depot/TASK-123 to main", but this doesn't work as expected with P4V: the p4v default commit message remains as "Copying //depot/TASK-123 to //depot/main", and it's only once you click "Copy" that the message changes.  This would be confusing to users, so I'd rather not do that.

Is it possible to configure the JIRA key detection pattern so that it's detected in //depot/TASK-123; alternatively is it possible to modify the default message produced by p4v?

(NB: looks like function getJiraCallouts in module/Jira/Module.php is the place to add this type of detection, but I don't know enough PHP to suggest how to do this)

#2 P4Shimada


    Advanced Member

  • Members
  • PipPipPip
  • 831 posts

Posted 10 February 2015 - 08:38 PM

Hi Neil,

Thank you for an example of your task stream naming system for JIRA issues. Which version of Swarm are you using?

Is the issue within the code for the trigger itself? I ask because you mentioned it did not recognize the JIRA issue keys with slashes. Have you tried using a 'change-submit' or a 'change-commit' trigger which searched and matched the changelist description for 'TASK-NNN' and then extracted it?

 grep -o '.\TASK-.\{0,4\}' <file-with-description>

I saw other posts on a search of 'JIRA key detection pattern' where JIRA users had issues with the issue key and some of the suggestions may help in your case, I hope. It looks like you can use regular expressions to identify your JIRA key pattern, from the Atlassian examples.




#3 Neil Padgen

Neil Padgen


  • Members
  • PipPip
  • 15 posts

Posted 02 June 2015 - 02:03 PM

Hi, sorry for the delay in replying.  (I had a temporary Perforce license which I was using to evaluate Swarm against our current depots; by the time I saw your reply the license had expired.  I've just (yesterday) set up Swarm 2015.1 against our production depot.)

I've configured the JIRA integration within Swarm, which is what's doing the detection of JIRA issue keys - not any trigger that I've written.  You can see from the image below that the JIRA has been detected when surrounded by whitespace, but not when prefixed by a slash.

Posted Image

Also tagged with one or more of these keywords: jira, swarm, p4v

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users