4

jenkins~权限控制

 1 year ago
source link: https://www.cnblogs.com/lori/p/17463144.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

jenkins上管理的任务比较多,这时需要有一定的权限管控机制,我们选择了插件Role-based Authorization Strategy来做这事,它支持按着项目前缀去控制你的任务,主要思想还是rbac的模式,通过角色绑定权限,通过用户来绑定角色。

118538-20230607135423638-518217268.png

通过jenkins Dashboard > Manage and Assign Roles

118538-20230607135520779-1960242971.png

图中第一项为添加角色,第二项为分配角色到用户

118538-20230607135647643-598394739.png

注意:我们默认有admin角色,我又扩展了一个read角色,这个角色的作用是让具体项目角色的人,看到自己的项目列表,这个read角色我们需要绑定到Anonymous用户上,这样我们项目角色里配置的角色就可以用了,否则会提示xxx is missing the Overall/Read permission的错误。

118538-20230607140029276-1139032146.png

项目角色的奇葩设计

为什么说它奇葩,是因为它的统配符规则,如果你想匹配dev产品管理,那么你的统配符必须是dev产品.*,注意是.*结尾,多个配置资源之间使用|分开,如下图所示:

118538-20230607140140307-1839443038.png

为用户指定角色

这个就比较容易了,与我们使用的大部分软件一下,从文本框中输入用户名,再勾选角色即可。

118538-20230607140505223-1741109453.png

最后,使用指定的用户名登录,就会看到自己对应权限的任务列表了

118538-20230607140542643-689684444.png

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK