Require commits to be associated with a JIRA issue
To implement Pre receive hook
We have put condition to enforce developer to have Jira ticket in commit message
def commits = refChanges.getCommits(repository)
def issueKeyRegex = /((?<!([A-Z]{1,10})-?)[A-Z]+-\d+)/
commits.any { commit ->
!(commit.message =~ issueKeyRegex)
}
But it will not validate the JIRA Issue key - means whether the Issue is Open or closed it accept the Issue key & commit - as it shouldn't allow commit if the Issue is closed , cancel , Resolved
Commit Policy is a Bitbucket app that allows enforcing issue keys that match the result of a certain JQL query!
It means that you can check if the key is existing, if the issue is in "In progress", if that is in the right project and everything else that JQL allows for.
Thanks for your suggestion Aron,
Is there any other way can do ? as we dont want use plugin at this moment ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I do not think you can do this without add-ons.
Please note that even your original half-solution in the question requires an add-on to execute the Groovy script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.