将Azure YAML固定或锁定在GIT存储库中或管道中

发布于 2025-02-11 05:51:24 字数 595 浏览 1 评论 0原文

我有两个Azure Git存储库,每个团队都只能查看并贡献自己的回购。

team1/repo1

  • entry.yaml

team2/repo2

  • 扩展。yaml

repo1 包含yaml文件,content

entry.yaml由team2拥有,在repo1 inter1

resources:
  repositories:
    - repository: repoSource
      type: git
      name: Project1/repo2
extends:
  template: extends.yaml@repoSource

extend.yaml repo2中的yaml也属于team2。

有没有办法防止进入。YAML被Team1修改,虽然仍然在同一存储库上对其他文件进行贡献,但原因是防止未经授权的脚本通过可能的替换为extent extent.yaml的作业定义的可能替换。与生产服务连接。

当检测到更改或删除的扩展模板时,我还尝试找到使CICD作业无效的方法。

I have two Azure Git Repos, for two teams, each team can only view, and contribute their own repos.

Team1/Repo1

  • Entry.yaml

Team2/Repo2

  • Extends.yaml

The repo1 contains YAML file, and content

Entry.yaml owned by Team2, in Repo1

resources:
  repositories:
    - repository: repoSource
      type: git
      name: Project1/repo2
extends:
  template: extends.yaml@repoSource

extends.yaml in Repo2 are also owned by Team2.

Is there a way to prevent Entry.yaml being modify by Team1, while still remain contributing change to other files on same repos, the reason is prevent unauthorize script run by possible replaces of the the job definition inside the extends.yaml to Entry.yaml with production service connection.

I am also try to find the way to invalidate the CICD job, when it detecting the extends template being change or removed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

季末如歌 2025-02-18 05:51:24

您几乎没有选择(您可以将它们全部组合在一起)。

  1. 使用环境只有在扩展模板时才强制管道运行:定义批准和检查 - 必需的模板

使用所需的模板检查,您可以强制执行管道使用特定的YAML模板。当该检查到位时,如果管道不从引用模板延长。

  1. 在Repo1中,您可以在主和版本/*分支上设置分支策略,并要求Team2在entry.yaml文件已更改时检查更改。请参阅自动包含代码审稿人

“在此处输入图像描述”

  1. 然后返回环境,您可以强迫管道从特定的分支中运行。 定义批准和检查 - 分支机构控制

使用分支控制检查,您可以确保从允许的分支构建与管道链接的所有资源,并确保启用分支的保护。这有助于控制释放准备和部署质量。如果多个资源与管道链接,则所有资源的来源都将得到验证。如果您已经链接了另一个管道,则验证了要部署的特定运行的分支以保护。

结合在一起,您应该能够以协作的方式实现自己想要的东西。

You have few options (you can as well combined them all together).

  1. Using environment, you could force a pipeline to only run if they extend a template: Define approvals and checks - Required template:

With the required template check, you can enforce pipelines to use a specific YAML template. When this check is in place, a pipeline will fail if it doesn't extend from the referenced template.

enter image description here

  1. In Repo1, You can set up branch policies on your main and releases/* branches and require Team2 to review changes if the Entry.yaml file has changed. See Automatically include code reviewers

enter image description here

  1. Then Back to environment, you could force a pipeline to run from specific branches. Define approvals and checks - Branch control:

Using the branch control check, you can ensure all the resources linked with the pipeline are built from the allowed branches and that the branches have protection enabled. This helps in controlling the release readiness and quality of deployments. In case multiple resources are linked with the pipeline, source for all the resources is verified. If you have linked another pipeline, then the branch of the specific run being deployed is verified for protection.

enter image description here

Combining these, you should be able to achieve what you'd like in a collaborative way.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文