gpt4 book ai didi

git - Azure DevOps : Pipeline Trigger CI build on branch in different repositories

转载 作者:行者123 更新时间:2023-12-02 07:45:28 24 4
gpt4 key购买 nike

我们如何从一个存储库中的提交触发管道到另一个存储库中的管道?

这基本上是这里详细提到的尚未解决的问题:

https://developercommunity.visualstudio.com/content/problem/891431/not-able-to-trigger-ci-build-on-branch-using-pipel.html?inRegister=true

官方文档没有明确说明是否可能 https://learn.microsoft.com/en-us/azure/devops/pipelines/build/triggers?view=azure-devops&tabs=yaml#pipeline-triggers

最佳答案

此功能仍在开发中。 Azure DevOps 服务很快就会提供对 YAML 管道的多存储库支持。

此功能将支持根据多个存储库之一中所做的更改来触发管道。请查看Azure DevOps Feature TimelineAzureDevOpsRoadmap 。预计将于 2020 年第一季度针对 azure devops 服务推出。

<小时/>

目前,您可以按照以下解决方法使用“构建完成”来实现上述目标(管道将在另一个构建完成时触发)。

假设有存储库 A 和存储库 B。您希望在推送到 A 的提交时触发 B 中的管道。

1,为repo A创建一个空的经典管道作为触发管道,它总是会成功并且不执行任何操作。

2、并选中“触发器”选项卡下的“启用持续集成”,并为此触发管道设置 Bracnh 过滤器,以确保在推送提交时触发此空管道。

enter image description here

3、在Repo B管道中设置构建完成触发器。

在 Repo B edit 页面的 yaml pipeline 中,点击右上角的3dots,然后点击Triggers。然后点击构建完成旁边的+添加,并选择上面在步骤1中创建的触发管道作为触发构建。 (也可以在Repo B的yaml管道中定义管道触发器,管道触发器查看here)

enter image description here

4、如果要构建Repo A的代码,还需要再执行一步在Repo B的管道中配置checkout repo。

在 Repo B 的管道中使用 Checkout查看管道中 Repo A 的代码。请引用以下示例:

steps: 
- checkout: git://MyProject/Repo A@refs/heads/master # Azure Repos Git repository in the same organization

- task: TaskName
...

关于git - Azure DevOps : Pipeline Trigger CI build on branch in different repositories,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60656386/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com