'jenkins Role-Based Strategy - project role patterns
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?
Solution 1:[1]
We can use shell regular expression to match the Jenkins projects.In this case we can use
Patter: \S*-stack
Solution 2:[2]
You could consider using regex (.*) in place of *
(.*)-stack
Solution 3:[3]
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:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Prash |
Solution 2 | dctw |
Solution 3 |