2

I am trying to provide a Role-Based Strategy project role patterns:

  Role to Add: sysadmin
  Pattern: *-stack 

While saving those changes, I am getting following error in Jenkins

Stack trace
java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0
*-stack
^
    at java.util.regex.Pattern.error(Pattern.java:1955)
    at java.util.regex.Pattern.sequence(Pattern.java:2123)
    at java.util.regex.Pattern.expr(Pattern.java:1996)
    at java.util.regex.Pattern.compile(Pattern.java:1696)
    at java.util.regex.Pattern.<init>(Pattern.java:1351)
    at java.util.regex.Pattern.compile(Pattern.java:1028)
    at com.michelin.cio.hudson.plugins.rolestrategy.Role.<init>(Role.java:90)
    at com.michelin.cio.hudson.plugins.rolestrategy.RoleBasedAuthorizationStrategy$DescriptorImpl.ReadRoles(RoleBasedAuthorizationStrategy.java:763)
    at com.michelin.cio.hudson.plugins.rolestrategy.RoleBasedAuthorizationStrategy$DescriptorImpl.newInstance(RoleBasedAuthorizationStrategy.java:711)
    at com.michelin.cio.hudson.plugins.rolestrategy.RoleBasedAuthorizationStrategy$DescriptorImpl.doRolesSubmit(RoleBasedAuthorizationStra

What is the error in my pattern?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Prash
  • 71
  • 3
  • 11

3 Answers3

1

We can use shell regular expression to match the Jenkins projects.In this case we can use

Patter: \S*-stack
Prash
  • 71
  • 3
  • 11
1

You could consider using regex (.*) in place of *

(.*)-stack
dctw
  • 19
  • 5
  • Well I tried the accepted answer on my Jenkins installation, didn't work for me. Tried with the regex and it worked fine. – dctw Jun 27 '19 at 07:31
  • If anyone's looking: `(.*)` works as match all, while `.*` doesn't. – shycha Mar 16 '20 at 22:24
0

In case you need to provide access to jobs inside the folder as well as to job in root:

folder_name.*|job_in_root

More information on this can be found here:

Oleksandr Shmyrko
  • 1,720
  • 17
  • 22