Jenkins 2多分支管道-如何使用角色策略插件限制分支的可见性/执行? [英] Jenkins 2 Multibranch Pipelines - How can I limit the visibility/execution of branches using the Role Strategy Plugin?
问题描述
我在具有两个分支的项目中使用多分支管道:开发和掌握.这将创建两个子项目,每个子项目一个:
I am using multibranch pipelines in projects with two branches: develop and master. This creates two subprojects, one for each branch:
App_Pipeline
|---master
|---develop
我已经设置了角色策略"插件,以根据分配的角色来控制作业/管道的授权(可见性).
I have set up the Role Strategy plugin to control the authorization (visibility) of the jobs/pipelines depending on the assigned role.
项目角色:
- 管理器:使用正则表达式
App_.*
- 开发人员:使用正则表达式
App_.*
- manager: Uses a regexp
App_.*
- developer: Uses a regexp
App_.*
在我目前的角色下,两种类型的用户都可以看到超级项目(App_Pipeline),并且可以执行两个子项目.
With my current roles, both types of users see the superproject (App_Pipeline), and can execute both subprojects.
重点是,我希望一些用户(开发人员)能够查看和运行开发子项目,而另一些用户(经理)能够查看和运行两个子项目(主项目和开发项目).
The point is that I want some users (developers) to be able to see and run the develop subproject and some others (managers) to view and run both subprojects, master and develop.
我还没有找到一种配置方法,知道如何实现吗?
I haven't found a way of configuring this yet, any idea how it can be achieved?
更新:这是问题的整个上下文.
UPDATE: This is the whole context of the problem.
我正在使用多分支管道来扫描整个Bitbucket项目,从而得到:
I'm using multibranch pipeline to scan a whole Bitbucket Project giving me:
ORGANIZATION
Repo1
|---master
|---develop
Repo2
|---master
|---develop
Poc-repo1
|---master
|---develop
Poc-repo2
|---master
|---develop
我需要支持以下情况:
- 某些用户只能阅读和构建带有Poc-前缀的项目.应该看不到其他任何项目.
- 其他用户可以阅读所有项目,但只能建立开发分支
- 最后,其他人可以阅读并构建所有项目
推荐答案
它受两级安全结构的支持,例如:
It's supported with two-level security structure, example:
rol1 ".\*holaArtifactoryMultibranch.\*" --> read
rol2 ".\*holaArtifactoryMultibranch/master.\*" --> build
现在,您可以将用户/组关联到rol1和rol2
Now, you can associate a user/group to rol1 and rol2
更新:
如果您有一个中间文件夹,我明白了:
I see your point, if you have an intermediate folder:
rol1 "^FOLDER$" --> read
rol2 "^FOLDER/holaArtifactoryMultibranch.\*$"--> read
您会看到holaArtifactoryMultibranch文件夹,但看不到其他文件夹.
You'll see the holaArtifactoryMultibranch folder, but not others.
这篇关于Jenkins 2多分支管道-如何使用角色策略插件限制分支的可见性/执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!