Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Failing a build if no Jira tickets in SVN commit message

Brenton Bartel August 7, 2012

Is there an easy/straight-forward way for Bamboo to fail a build if there are no legit Jira tickets in SVN commit message?

2 answers

1 accepted

0 votes
Answer accepted
Sean Dockery August 14, 2012

You can install a pre-commit hook in the Subversion server that rejected a commit based on the fact that a valid unresolved JIRA issue key was not found in the commit message. There are a dozen or so pre-commit hooks for this purpose already out there, so you wouldn't have to develop your own.

0 votes
Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 7, 2012

You could try adding a script task. The simplest case:

svn log -r ${bamboo.custom.svn.lastchange.revision.number}:${bamboo.custom.svn.revision.number} | egrep 'PROJ1-|PROJ2-' || exit 1

would fail a build if no commits in a build have something that looks like a JIRA ticket in the comment body.

If you want to check that the JIRA tickets actually do exist, or make sure that each commit in a build has a JIRA ticket, you need to parse the svn log output and make REST calls to JIRA to query for tickets.

Brenton Bartel August 14, 2012

We have dozens of projects always being added, but this is a great start. I suppose I could use Jira's API to check if the ticket exists ... there's no plugins out there like that that already exist?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events