Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

pathsMatchExcludingDeletes() is applicable for argument types: String

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.

 

1 answer

Hi @Pavan_Nayakanti ,

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

What version of ScriptRunner are we using? - 5.6.2
What version of Bitbucket are we using? - 5.15.1

Hi @Pavan_Nayakanti ,

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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

⭐ Calling all Bitbucket and DevOps experts: Special showcase opportunity ⭐

Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...

1,482 views 4 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you