【发布时间】:2022-08-11 10:31:17
【问题描述】:
我有两个 Azure DevOps 管道: 管道 A:主管道 管道 B:公关审查管道
因此,管道 B 在我的 github 存储库中有 CI/CD,一旦发出拉取请求,就会触发管道作业。此管道仅包含 RestAPI 任务,该任务以一些模板参数作为主体调用管道 A。
问题是。 如何使用用于该特定拉取请求的 github 源分支从管道 B 触发管道 A。
谢谢
标签: azure-devops
我有两个 Azure DevOps 管道: 管道 A:主管道 管道 B:公关审查管道
因此,管道 B 在我的 github 存储库中有 CI/CD,一旦发出拉取请求,就会触发管道作业。此管道仅包含 RestAPI 任务,该任务以一些模板参数作为主体调用管道 A。
问题是。 如何使用用于该特定拉取请求的 github 源分支从管道 B 触发管道 A。
谢谢
标签: azure-devops
您可以为管道 B 中的源分支设置 PR 触发器
并为 Pipeline A 设置 Pipeline 资源触发器。然后 Pipeline B 完成后 Pipeline A 将自动运行:https://docs.microsoft.com/en-us/azure/devops/pipelines/process/pipeline-triggers?view=azure-devops
管道 A 示例:
pool:
vmImage: ubuntu-latest
# Pipeline A YAML pipeline
# We are setting up a pipeline resource that references the Pipeline B
# and setting up a pipeline completion trigger so that Pipeline A
# runs when a run of Pipeline B completes
resources:
pipelines:
- pipeline: PR # Name of the pipeline resource.
source: Pipeline B # The name of the pipeline referenced by this pipeline resource.
trigger: true # Run Pipeline A when any run of Pipeline B completes
steps:
- bash: echo "Pipeline A runs after Pipeline B completes"
【讨论】: