Jenkins 2 Multibranch Pipelines - 如何使用角色策略插件限制分支的可见性/执行? [英] Jenkins 2 Multibranch Pipelines - How can I limit the visibility/execution of branches using the Role Strategy Plugin?

查看:30
本文介绍了Jenkins 2 Multibranch Pipelines - 如何使用角色策略插件限制分支的可见性/执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在具有两个分支的项目中使用多分支管道:开发和主控.这会创建两个子项目,每个分支一个:

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.

项目角色:

  • ma​​nager:使用正则表达式 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?

更新:这是问题的全部背景.

我正在使用多分支管道扫描整个 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

我需要支持这些情况:

  1. 某些用户只能读取和构建带有 Poc- 前缀的项目.不应该看到任何其他项目.
  2. 其他用户可以阅读所有项目,但只能构建开发分支
  3. 终于其他人可以阅读和构建所有项目

推荐答案

支持两级安全结构,例如:

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 Multibranch Pipelines - 如何使用角色策略插件限制分支的可见性/执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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