I am using SVN-1.7.4 for revision control and atlassian JIRA as the issue tracker for my LAMP website. I want to restrict SVN commit if any of my team member commits without mentioning the Jira Issue key for the same. I am using JIRA standalone and have installed it on my server. Google search gave me Subversion Jira Plugin (https://studio.plugins.atlassian.com/wiki/display/SVN/Subversion+JIRA+plugin) but it can only help me out in tracking the commits that had a JIRA key, not in restricting them. Please let me know, if I should post any more specifics about the issue.
相关问题
- How can I set the SVN password with Emacs 23.1 bui
- If statements in .htaccess files, to enable passwo
- Set assignee field when creating an issue in JIRA
- How to serialize a jira issue object in Python?
- SVN+SSH checkout over VPN using tortoise SVN, Smar
相关文章
- Public issues in JIRA
- Is there a version control system abstraction for
- Intermittent “SVNException: svn: E175002: Connecti
- IntelliJ Subversion Authentication Required Dialog
- TortoiseHG and hgsubversion (Windows): “no module
- Incompatible JavaHl library loaded
- TFS vs. JIRA/Bamboo/SVN [closed]
- converting svn repo to git using reposurgeon
I happen to have a pre-commit hook that covers this (as well as many other things).
The hook is available via Git-Hub. It doesn't verify that the Jira ID exists, but it can verify that a Jira like ID does exist in the commit message. This is usually good enough to ensure developers are adding in Jira ticket numbers into their commit message. There's an example
control.ini
file that shows you how to check for a Jira like ticket number in your commit message. Valid commit messages would be formatted as follows:However, a better way than a pre-commit hook is to change the culture of the workplace, so that developers will naturally put the Jira ticket number in commit messages and will automatically give more detailed commit messages. I found that using a continuous build server like Jenkins will do this.
Jenkins will automatically build your code with each check in. Each build shows you the changes, and the commit comment. Jenkins integrates to Jira, so with one click, you can see the Jira information. Jenkins will also attach the commit message and build # onto the Jira ticket, so a QA person can look at a particular Jira ticket, and see which build fixed this ticket.
Suddenly, the commit message information becomes more visible. Developers and QA start to rely on it. Developers who don't add the Jira ticket, are hounded not by the guy who does the builds, but by their boss and their fellow developers. Putting good commit messages now becomes the culture of the place. And, that's a way better enforcer than any pre-commit hook.
Following script has added regex to find any pattern like abc-123 and check if it is present in jira. Also any similar pattern could also be present , anywhere in the comment but presence of one successful pattern will allow the commit -
Commit Policy Plugin is a fairly new JIRA add-on to enforce this.
Unlike the other solutions suggested here, it does not only verify if there is an issue key like pattern in the commit message (like "FOO-123"), but even matches that against a configure JQL query in JIRA!
For instance, this allows to check if the mentioned issue(s) are:
Other than checking the mentioned issues, it can also verify:
Make sure you check out the documentation and try it.
Disclaimer: I'm a developer working on this add-on. Nevertheless this is the best solution available to this problem.
Atlassian provides a trigger script that does this for most common VCS systems including SVN, plus a JIRA plugin that lets you define what to look for in the commit description. See the JIRA Commit Acceptance plugin page.
Well, i did it creating a simple shell script (pre-commit) hook that verify if jira issue key was supplied by a regex and call a REST API to guarantee the issue exists on the server
It's not difficult to check that the issue exists in JIRA also, using the JIRA ReST API.
In our case I used the
pre-commit.tmpl
file and added the following after the opening comments section:This requires the the message to be of the form "JIRA-id: text" or "JIRA-id test". You could make the regular expression more general to allow a JIRA id anywhere in the text. You could also add checks on the
${JIRAISSUE}
to ensure that the issue is open if desired, but this seems sufficient for our purposes.