天蓝色管道中不同存储库中不同分支的父管道是否可以触发子管道?
Can a child pipeline be triggered by the parent pipeline from a different branch in a different repo in azure pipelines?
我在 main 分支下的 repo1 中创建了一个父管道。我创建了两个子管道,child1 在 repo_child1 分支下 main 和 child2 在 repo_child2 下分支 new_branch.
下面是管道的代码:
父管道代码:
trigger: none
pool:
vmImage: ubuntu-latest
stages:
stage: child1
jobs:
job:
steps:
script: echo "trigger child 1 pipeline"
stage: child2
jobs:
job:
steps:
script: echo "trigger child 2 pipeline"
子管道 1
trigger: none
pool:
vmImage: ubuntu-latest
resources:
pipelines:
pipeline: 'someidforparent'
source: 'parent'
trigger:
stages:
- child1
stages:
stage:
jobs:
job:
steps:
script: echo "you are in child1 pipeline"
child2 管道
trigger: none
pool:
vmImage: ubuntu-latest
resources:
pipelines:
pipeline: 'someidforparent'
source: 'parent'
trigger:
stages:
- child2
stages:
stage:
jobs:
job:
steps:
script: echo "you are in child2 pipeline"
当我运行父流水线时,child1流水线在parent中的child1阶段执行后触发。但是永远不会调用 child2 管道。
你能帮我理解一下在父管道中执行阶段 child2 后没有触发 child2 管道的原因是什么?
提前致谢。
Can you help me understand what could be the reason that child2 pipeline is not triggered after the execution of the stage child2 in the parent pipeline?
那是因为管道文件 child2.yml
在主分支中不存在。
当我们设置阶段过滤器时,它会在主分支中搜索触发的管道文件parent.yml
,然后它会在同一分支main
中搜索child2.yml .这就是为什么你的 child2
在分支 new_branch
下的 repo_child2
没有被触发的原因。
要解决此问题,您可以为 child2
添加构建完成:
我在 main 分支下的 repo1 中创建了一个父管道。我创建了两个子管道,child1 在 repo_child1 分支下 main 和 child2 在 repo_child2 下分支 new_branch.
下面是管道的代码:
父管道代码:
trigger: none
pool:
vmImage: ubuntu-latest
stages:
stage: child1
jobs:
job:
steps:
script: echo "trigger child 1 pipeline"
stage: child2
jobs:
job:
steps:
script: echo "trigger child 2 pipeline"
子管道 1
trigger: none
pool:
vmImage: ubuntu-latest
resources:
pipelines:
pipeline: 'someidforparent'
source: 'parent'
trigger:
stages:
- child1
stages:
stage:
jobs:
job:
steps:
script: echo "you are in child1 pipeline"
child2 管道
trigger: none
pool:
vmImage: ubuntu-latest
resources:
pipelines:
pipeline: 'someidforparent'
source: 'parent'
trigger:
stages:
- child2
stages:
stage:
jobs:
job:
steps:
script: echo "you are in child2 pipeline"
当我运行父流水线时,child1流水线在parent中的child1阶段执行后触发。但是永远不会调用 child2 管道。
你能帮我理解一下在父管道中执行阶段 child2 后没有触发 child2 管道的原因是什么?
提前致谢。
Can you help me understand what could be the reason that child2 pipeline is not triggered after the execution of the stage child2 in the parent pipeline?
那是因为管道文件 child2.yml
在主分支中不存在。
当我们设置阶段过滤器时,它会在主分支中搜索触发的管道文件parent.yml
,然后它会在同一分支main
中搜索child2.yml .这就是为什么你的 child2
在分支 new_branch
下的 repo_child2
没有被触发的原因。
要解决此问题,您可以为 child2
添加构建完成: