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 Join to answer
Community showcase
Maarten Cautreels
Posted Thursday in Off-topic

Friday Fun: What's your favourite beer/drink

As a Belgian, beer-lover and home brewer, beer is one of my great passions. I love the fact that with just a few ingredients (usually just water, hop and malt) you can create so many different tastes...

281 views 38 9
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot