Comments not added to JIRA issues

Florian Mittag's Avatar

Florian Mittag

09 Oct, 2018 02:29 PM

This might be a very simple problem, but I couldn't find any documentation about it here or anywhere else.

We recently switched to JIRA and RhodeCode and I'm not happy about the integration. When I make a commit to my Mercurial repository with the commit message "#PROJECT-123 Add new test case", the change will correctly be linked to the issue in JIRA, but the comment is rather useless:

CODE QS added a comment - 1 day ago
Commit 1234567890ab by User <[email blocked]> on Test Cases branch references this issue. https://code.example.com/Project123/changeset/1234567890abcdef1234567890abcdef

What I expect is to see "Add new test case" or "#PROJECT-123 Add new test case" as comment. I don't want to follow the link to the RhodeCode site to see the comment. Did we configure something incorrectly? Or is this something that can't be done?

Thanks in advance

  1. Support Staff 1 Posted by Marcin Kuzminsk... on 09 Oct, 2018 03:06 PM

    Marcin Kuzminski's Avatar

    Hi Florian,

    Thank you for your message. Yes, i can confirm that the JIRA/Redmine integration doesn't add the commit message into the comment body.

    The reasons for that is some security concerns we had. Namely, users who have access to the issue tracker not necessarily should have access to the commit or VCS data. Exposing a link adds that layer of protection since only people who have access will be able to see the commit data and message.

    Think about some critical security issues which is described in the commit message could get exposed to some public issue tracker. This is why we expose only limited information, to have a most secure default.

    That said, we're getting a lot of feedback about the integration type text. We plan to add some options to override default templates used for those. So for release 4.14 we'll have a new option to set some custom templates, and you will be able to add your own formatting and expose data you wish to have.

    Hope this answers your question.

  2. 2 Posted by Florian Mittag on 10 Oct, 2018 08:11 AM

    Florian Mittag's Avatar

    Hi Marcin,
    thank you for your quick reply, now I can tell our admins to stop searching ;)
    I understand the rationale behind this, but since we are (currently) using both JIRA and RhodeCode purely internally, you can count us to those users that would very much like the option to override the default templates used for commit messages.

    Thanks again!
    Florian

  3. 3 Posted by Florian Mittag on 09 Nov, 2018 08:44 AM

    Florian Mittag's Avatar

    Hi Marcin,

    we upgraded to the new version 4.14.0 now and I'd like to know if the option for custom templates has indeed been added and where I can find it.

    Thanks!
    Florian

  4. Support Staff 4 Posted by Marcin Kuzminsk... on 09 Nov, 2018 01:31 PM

    Marcin Kuzminski's Avatar

    Hi Florian,

    Yes in 4.14 this is now possible using the new rcextensions. You can find how to install/update them in the documenation.

    Below is an example how to change the template:

    # This code allows override the integrations templates. Put this into the __init__.py
    # file of rcextensions
    
    # JIRA (EE ONLY)
    from rc_integrations import jira_tracker
    
    jira_tracker.COMMENT_TEMPLATE_PULL_REQUEST = jira_tracker.Template('''
    ${action} by ${author} (status: ${status}). \n
    pull-request: ${url}
    ''')
    
    
    jira_tracker.COMMENT_TEMPLATE_COMMIT = jira_tracker.Template('''
    Commit `${short_id}` by ${author} on `${branch}` branch references this issue. \n
    ${url}\n
    
    ## MODIFICATION add custom COMMIT message to the comment
    ${commit['message']}
    ''')
    
    
    jira_tracker.COMMENT_TEMPLATE_COMMIT_WITH_STATUS = jira_tracker.Template('''
    Commit `${short_id}` by ${author} on `${branch}` branch changed this issue. \n
    ${url}\n
    
    ## MODIFICATION add custom COMMIT message to the comment
    ${commit['message']} 
    ''')
    

    Hope that solves your problem :)

    Let us know if it gives you troubles.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac