jenkins Role-Based Strategy - project role patterns

6.8k Views Asked by At

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?

3

There are 3 best solutions below

0
Prash On BEST ANSWER

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

Patter: \S*-stack
2
dctw On

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

(.*)-stack
0
Oleksandr Shmyrko On

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: