Can the commit acceptance plugin require that the issue key be the first token in an SVN comment?

Rob Horan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 10, 2014

We want to enforce having the Jira issue key as the first token/word in comment when checking in to SVN. We are using the commit acceptance plugin to ensure that there is a valid Jira ticket and that the ticket is unresolved before anything can be committed.

In addition, we would like to ensure no other tickets appear in the comments, if that is possible.

2 answers

0 votes
Midori
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 28, 2015

The Commit Policy add-on (a "commit acceptance on steroids") can easily do this with following settings:

  1. Add a "Commit message must contain issue keys from a JQL query" type condition and specify the count as "exactly one": it will reject commit messages that mention invalid or resolved issues or those that mention zero or more than one of those. Set up the JQL that exactly matches your filtering requirements.
  2. Also add a "Commit message must match a pattern" condition with a regex that require the issue key in the starting position. There is an example for this in the plugin's configuration screen.

The documentation of the various conditions is available here: http://www.midori-global.com/products/jira-commit-policy-plugin/documentation/#conditions

0 votes
Felipe Kraemer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 28, 2014

Hi Robert,

As the commit must be done directly in the repository first, to only then show up in JIRA, this cannot be enforced by the plugin.

Unfortunately this is a user education task rather than a plugin task. Users must have that in mind before committing, because there's no turning back after source code changes have been committed.

Also, the plugin will show all JIRA tickets that are mentioned in the comments, so if you want to show only one ticket please make sure that only one ticket is mentioned in the commit message.

Kind regards,
Felipe Kraemer

Suggest an answer

Log in or Sign up to answer