我有一个 Repo A,上面有一些代码。有一个很大的 Repo B ,上面有一些其他代码。 我想仅当 Repo B 中的 App/SampleApp 文件夹在 main 分支上更新时才触发我的 Repo A 运行管道。我只希望它在该文件夹更新时触发,因为还有许多其他目录。
我已经在线阅读了一些文档和其他问题,但它们似乎更适合同一存储库中的文件夹。我想根据不同存储库文件夹中的更改来触发。 这两个存储库都位于同一项目和组织中。
这是我的 yml:
resources:
repositories:
- repository: RepoB
name: repo-b
ref: main
type: git
trigger:
branches:
include:
- main
paths:
include:
- App/SampleApp/*
stages:
- stage: Build
jobs:
- template: build.yml
Azure 向我显示,当我转到管道设置时,我获得了正确的存储库,但我不认为它只是获得了我想要触发的文件夹。我不确定它如何知道路径正在引用哪个存储库。
例如,您在同一个项目 myProject 中有 RepoA 和 RepoB。
resources:
repositories:
- repository: A
type: git
name: myProject/RepoA
- repository: B
type: git
name: myProject/RepoB
trigger:
branches:
include:
- main
paths:
include:
- App/SampleApp/*
steps:
- checkout: A
- bash: |
echo "333"
当 RepoB 在文件夹 App/SampleApp 的主分支上更新时,管道将被触发。
它会签出 RepoA,以便您可以使用 RepoA 中的源代码来运行您的管道。