Role Strategy Plugin - how to apply multiple patterns in project roles

4,899 views
Skip to first unread message

Jan Seidel

unread,
Oct 11, 2013, 7:25:08 AM10/11/13
to jenkins...@googlegroups.com

Hi folks,

I am setting up Role Strategy as too many people can peek and poke in too many jobs and mess around.
We have many build jobs which leads me to a problem when assigning Roles in Projects roles.

I need multiple patterns for a single role if possible.
e.g. the role MIB admin must access all jobs starting with (?i)RB_MIB.*, (?i)HMI_MIB.* and (?i)JXE_MIB.* but not (?i)MB_GUIDE_MIB.* nor any other job that is outside of the scope of this project.
So simply taking (?i).*MIB.* won't work.

Is it possible to use multiple patterns for one role and if yes, how?

Cheers
Jan


Daniel Beck

unread,
Oct 11, 2013, 7:35:12 AM10/11/13
to jenkins...@googlegroups.com
There's no way to define multiple patterns for a given role (which would enable different permissions depending on the job for the same role).

But the pattern '(RB|HMI|JXE)_MIB.*' should do it. Maybe look up the java.util.regex.Pattern docs?
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Maneesh M P

unread,
Oct 15, 2013, 4:25:17 PM10/15/13
to jenkins...@googlegroups.com, m...@beckweb.net
You can do with piping I guess

(?i)RB_MIB.* | (?i)HMI_MIB.*  | (?i)JXE_MIB.*

Thanks,
Maneesh

Kaushal

unread,
Mar 22, 2019, 6:02:32 AM3/22/19
to Jenkins Users
Maneesh thanks for the reference.

@daniel 

the following worked for me

"(?)joba||(?)jobb||(?)jobc||(?)jobn"

where job{a..n} are the job names.

Rob C

unread,
May 12, 2022, 4:19:28 PM5/12/22
to Jenkins Users
I'm replying because this thread is a very high result on google searches.
You can enter a string such as this into the "Pattern" field to allow a single role to apply multiple prefix patterns

((prefix1|prefix2|prefix3).*)

Or if you want to match on the middle of a job name you can do something like this

(.*(middle1|middle2|middle3).*)


Reply all
Reply to author
Forward
0 new messages