Link JIRA with GoCD

835 views
Skip to first unread message

Darly Senecal-Baptiste

unread,
Jun 2, 2016, 3:11:40 PM6/2/16
to go-cd-dev
Hi all:

Just a proposal, 

Based on the information for External Tools integration, [https://docs.go.cd/current/integration/go_integration.html] it is mentioned that GoCD can be integrated with JIRA. However, while setting the tool integration with the JIRA url as URI and the pattern as ^([A-Z](2))[A-Z](\-)(\d+), it didn't work. Keep in mind that developers mention JIRA tickets within theirs commit messages. Also, is there a way to link a specific build into the mentioned JIRA id.

Please advise.

Aravind SV

unread,
Jun 2, 2016, 3:45:44 PM6/2/16
to GoCD Dev
Can you provide an example commit message? What that integration does it to find the matching string in commit messages (using the provided regex) and then makes it a link.


Also, is there a way to link a specific build into the mentioned JIRA id.

I don't understand this.

--
You received this message because you are subscribed to the Google Groups "go-cd-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Darly Senecal-Baptiste

unread,
Jun 2, 2016, 4:22:21 PM6/2/16
to go-c...@googlegroups.com
A commit message might be the following:

Bug  JIRA-123 : Explanation

--
You received this message because you are subscribed to a topic in the Google Groups "go-cd-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/go-cd-dev/iL4snEiZug4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to go-cd-dev+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Regards,

Darly Senecal-Baptiste
Configuration Manager / Devops
Addteq | Atlassian Platinum Expert | Princeton, NJ



Aravind SV

unread,
Jun 2, 2016, 7:28:16 PM6/2/16
to GoCD Dev
Have you tried this:

<trackingtool link="https://my-jira/${ID}" regex="[A-Z]+-(\d+)" />

The regex is about recognizing the part of the commit message that contains the ID you need.

If you want "JIRA-123" to be the ID you want to use in a URL, you should try something like: ([A-Z]+-\d+). You can't have more than one group (the thing in parens), I think.

Cheers,
Aravind

Darly Senecal-Baptiste

unread,
Jun 3, 2016, 1:36:49 PM6/3/16
to go-c...@googlegroups.com
Hi Aravind,

Tested the regex'es that you had provided with no success. From JIRA's perspective, the url for the ticket is more as follow

http(s)://my-jira/browse/${ID}. 

And question, had you guys think about using REST API. (A simply sugestion)

Tim Brown

unread,
Jun 3, 2016, 2:09:13 PM6/3/16
to go-c...@googlegroups.com
Drop the ^ off the front of the regex and it should work.    That's making it look for foo-123 at the start of the commit string.  It won't match in the middle.


Aravind SV

unread,
Jun 3, 2016, 7:12:01 PM6/3/16
to GoCD Dev
Tim is right about the caret (^).


On Fri, Jun 3, 2016 at 1:36 PM, Darly Senecal-Baptiste <darly.b...@addteq.com> wrote:
Tested the regex'es that you had provided with no success. From JIRA's perspective, the url for the ticket is more as follow

http(s)://my-jira/browse/${ID}.

I tested that regex on a real (local) GoCD server. So, I know it works. :) I don't know if your expectation is that a commit with "Bug JIRA-123 abc" will change the status of that ticket (card?) in Jira. That won't happen. This will just make sure that whenever a commit message has "JIRA-123" or "JIRA-456" in it, it'll make that part a link and make that link point to: http://my-jira/browse/JIRA-123 or http://my-jira/browse/456 as you defined.

If your expectation is that a successful build will change the status in Jira, it's possible through a small script which calls the Jira API at the appropriate time in the pipeline (say, the task, after running tests). I've done that before (many, many years ago) on a project. You can get very creative with that. I don't have that script, but I think the JIRA API documentation is quite decent.

Cheers,
Aravind
Reply all
Reply to author
Forward
0 new messages