Jenkins - 如何根据项目设置授权 [英] Jenkins - How to set authorization on project basis

查看:35
本文介绍了Jenkins - 如何根据项目设置授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Jenkins 中,我有两个不同的项目和两个我想要授权的用户:

In Jenkins I have two different projects and two users I want to authorize:

User1 只能查看、构建、部署 Project1.

User1 can only view, build, deploy Project1.

User2 只能查看、构建、部署 Project2.

User2 can only view, build, deploy Project2.

我已经安装了基于角色的插件,但无法让它工作.请帮忙.

I have installed role based plugin, but am unable to get it working. Please help.

推荐答案

我同意 Project Based 可以解决您的问题,但如果您有 100 个用户,这会让管理员头疼.然后对于每个用户,您必须授予权限,这对于那些面临基于角色的插件问题的人来说将是很多努力.这是解决方案:-

I agree Project Based could solve your problem but it would create headache on administrator if going forward you have 100 users. Then For each user you have to give permissions,which will be a lot of effort and for those who are facing issues with Role based plugin. Here is the solution:-

第 1 步:- 单击 Manage Jenkins 下的 Global configuration.

Step 1:- click on Global configuration under Manage Jenkins.

第 2 步:- 单击单选按钮基于角色的策略"并保存.

Step 2:- click on radio button "Role-Based Strategy" and save.

第 3 步:- 转到管理 Jenkins"下的管理和分配角色".

Step 3:- Go to Manage and Assign Roles under Manage Jenkins.

第 4 步:- 选择管理角色".

Step 4:- select Manage Roles.

第 5 步:- 您将看到与

Step 5:- You will see somewhat similar image as

第 6 步:- 现在在要添加的角色"选项下从管理员添加全局角色部分并仅授予读取权限.以蓝色显示

Step 6:- Now add a global role part from admin under "role to add" option and grant Read Permission only.Shown in Blue color

例如:- 在这种情况下的员工

For eg:- Employee in this case

第 7 步:- 对于上面的问题和下面的例子,一些假设

Step 7:- For the above question and below example some assumptions

Test = Project1
check = Project2

在项目角色下:-

 Role to add:-developer

 Pattern:-Test

这意味着开发人员将只能查看项目测试".

This means developer will be able to view only Project "Test".

Pattern 基本上是您的项目名称.您也可以在这里使用正则表达式.例如:-模式:- 测试*那么所有以 Tes 开头的项目都将成为开发人员.

Pattern is basically your project name.You can use regular expressions also here. For eg:- Pattern:- Tes* then all projects beginning with Tes will have role as developer.

同样添加角色为测试员和模式为检查,显示在黑框下,测试员将只能查看项目检查"

Similarly Add role as tester and Pattern as check,shown under black box,Tester will be able to view only Project "check"

第 8 步:- 通过复选框提供相应的权限视图、构建等,然后单击保存.

Step 8:- Give the respective permissions view,build etc by check boxes and click on save.

第 9 步:- 现在返回到管理角色并选择分配角色,您会发现类似的内容.

Step 9:- Now go back to Manage Roles and select assign role and you will find something similar to this.

第 10 步:- 在全局角色下添加 user1 和 user2 并选中 Employee 作为他们的角色,如上图中黑框所示.

Step 10:- Under Global role add user1 and user2 and check box on to Employee as their role as shown in in the image above in black box.

[注意]每个新用户/组都必须在此处添加并赋予员工或管理员角色.

[NOTE]Every New User/Group has to be added here and given the role of employee or admin.

第 11 步:- 在项目角色下,

Step 11:- Under Project Role,

添加用户 1 和用户 2 并为其分配测试人员和开发人员角色.如绿色所示.

Add user1 and user2 and assign them tester and developer role. As shown in green color.

点击保存.

[注意]

Developer will be able to view only Project "Test"
tester will be able to view only  Project "check"

这篇关于Jenkins - 如何根据项目设置授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆