Hi,
Am working for a script in order to restrict pushing changes to a particular folder for a specific team.
It was a straight forward script available online.
https://scriptrunner.adaptavist.com/4.3.19/bitbucket/PreReceiveHooks.html
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.bitbucket.auth.AuthenticationContext
import com.atlassian.bitbucket.user.UserService
def userService = ComponentLocator.getComponent(UserService)
def authContext = ComponentLocator.getComponent(AuthenticationContext)
if (pathsMatchExcludingDeletes("glob:UserGUI/src/localizationsnapshot/**")) {
// return true if the user is NOT in the desired group, thus blocking the push
return ! userService.isUserInGroup(authContext.getCurrentUser(), "!Team Core FTE")
}
return false
However, i kept getting below error and there is no much help available to resolve it.
Time (on server): Fri May 28 2021 15:53:55 GMT-0400 (Eastern Daylight Time)
The following log information was produced by this execution. Use statements like:log.info("...") to record logging information.
2021-05-28 14:53:55,467 ERROR [c.o.s.b.ScriptedPreReceiveGlobalHook]: *************************************************************************************
2021-05-28 14:53:55,482 ERROR [c.o.s.b.ScriptedPreReceiveGlobalHook]: Script pre-receive hook failed: repository: jasontest, file: <inline script>
groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.pathsMatchExcludingDeletes() is applicable for argument types: (String) values: [glob:UserGUI/src/localizationsnapshot/**]
at Script31.run(Script31.groovy:8)
at Script31.run(Script31.groovy:8)
Let me know in case of any inputs in this regard.