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

This widget could not be displayed.

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.

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in Statuspage

What are your best incident management tips and stories? #HugOps

 👋Community members! Downtime happens. And great incident response takes a village. Teams like Support, Dev, SRE, Ops, IT, and Marketing have to come together to resolve the problem while keep...

60 views 2 3
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