Hello,
Using ScriptRunner add-on 5.1.8 with Bitbucket 5.3.2, is there a way to enforce naming conventions for projects and repos? If so, how?
I see that there is enforcing naming conventions for feature and bugfix branches using the Pre-receive Hooks, but is there anything for project and repo names?
Thanks,
Mary
You could do that using a custom event handler.
For example you can use the following script for the ProjectCreationRequestedEvent. You'll need to change the regex part. At the moment it enforces that project keys must begin with a C followed by at least one upper case character in A-Z.
def regex = "C[A-Z]+"
if (! (event.project.key ==~ /${regex}/)) {
event.cancel("Project key must start with C!")
}
Let us know how that goes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mary,
There is an event handler for that using ScriptRunner. It's called "Naming standard enforcement" with the description "Enforce project and repository naming standards".
The documentation can be found here but it's works similarly to the branch and tag naming convention one.
Let us know how you get on.
Thanks,
Adam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, Adam!
I was on an older version, so I didn't see that available.
But, is there a way to enforce a naming convention for the Project Key? I'm now fine with the Project Name being descriptive, but I need to enforce a naming convention on the Project Key.
Mary
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.