pathsMatchExcludingDeletes() is applicable for argument types: String
Asked by Pavan_Nayakanti:

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.


Answers:
author: Robert Giddings [Adaptavist]
body: Hi [@Pavan_Nayakanti](/t5/user/viewprofilepage/user-id/4406466) ,

Please can you confirm which version of Bitbucket and ScriptRunner for Bitbucket you are using and I will look further into this for you.

Kind regards,

Robert Giddings,

Product Manager, ScriptRunner for Bitbucket

comments: author: Pavan_Nayakanti
body: What version of ScriptRunner are we using? - 5.6.2  
What version of Bitbucket are we using? - 5.15.1


author: Robert Giddings [Adaptavist]
body: Hi [@Pavan_Nayakanti](/t5/user/viewprofilepage/user-id/4406466) ,

Thank you for your response.

We no longer support those versions of Bitbucket or ScriptRunner for Bitbucket.

Is it possible for you to first upgrade to a supported version of Bitbucket and ScriptRunner for Bitbucket?

We support versions of Bitbucket, as listed on Atlassian's End of Life policy here: <https://confluence.atlassian.com/support/atlassian-support-end-of-life-policy-201851003.html>

And again support the compatible versions of ScriptRunner for Bitbucket.

If you first upgrade to a supported version of Bitbucket and ScriptRunner for Bitbucket, and you still get the same error, you could then raise a support ticket with our Support Team.

Please let me know if updating both Bitbucket and ScriptRunner for Bitbucket is possible for you?

Kind regards,

Robert Giddings,

Product Manager, ScriptRunner for Bitbucket


Tags: bitbucket-server

server