Failing a build if no Jira tickets in SVN commit message

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

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 vote

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.

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Marketplace Apps

Tips on how to choose the best estimation method for your planning

Planning and grooming sessions all come with their own sets of rules. Team members meet to estimate stories or other work items, all according to an agreed-upon process. And with every session comes ...

71 views 0 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you