如何解决Jenkins-如何配置受限制但有用的用户帐户
在Jenkins中-如何配置受限但有用的用户帐户,该帐户可以:仅查看,取消和重播选定作业的运行?
解决方法
(在Jenkins 2.235上测试)
- 配置全局安全性(针对所有项目/职位):
Login as admin.
Manage Jenkins.
Configure Global Security.
Project-based Matrix Authorization Strategy.
Add user or group.
User or group name.
<enter username>
Check the following checkboxes:
Overall.Read
Agent.Build,Job.Build,Job.Cancel,Run.Delete,Run.Replay,Run.Update
Save
- 配置本地安全性(针对选定的项目/职位):
Jenkins->All
<choose existing pipeline>
<select dropdown on the pipeline name>
Configure
Enable project-based security <checkbox>
Add user or group
User or group name
<enter username>
Check the following checkboxes:
Job.Build,Job.Read,Run.Update,Save
Logout
- 测试
Login as <username>
you should see only one pipeline
Test if Build Now works (this action is by default disabled)
Switch to Blue Ocean view
Message should say: "Started by user <username>"
Click the Stop button on the latest run
Status should change to "aborted"
Click on the Rerun button
<refresh>
Message should change to "Replayed #<run ID>"
请注意,Github OAuth Plugin与基于项目的矩阵授权策略很好地集成在一起,仅在这种情况下,必须使用现有的Github用户名来代替Jenkins内部用户名。授权Github项目合作者运行Jenkins构建。
,更具扩展性的替代方法是使用Role-based Authorization Strategy Jenkins插件。但是,不要在家尝试,因为它似乎需要LDAP服务器:
-
安装插件
-
启用插件: 管理詹金斯->配置全局安全性->授权:基于角色的策略->保存
-
创建新角色,例如管道用户: 管理詹金斯->未分类:管理和分配角色->管理角色->全局角色->要添加的角色->管道用户->添加->添加这些角色(使用复选框):总体,读取,作业,构建,作业.Cancel,Job.Read,Run.Delete,Run.Replay,Run.Update->保存
-
为用户分配新创建的角色 管理詹金斯->未分类:管理和分配角色->分配角色->全局角色->要添加的用户->->添加->管道用户->要添加的用户->->添加->管道用户->保存
尝试以user1身份登录后,Jenkins无法正确识别user1权限。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。