【问题标题】:Trigger pipeline with a pipeline github branc from another pipeline使用来自另一个管道的管道 github 分支触发管道
【发布时间】:2022-08-11 10:31:17
【问题描述】:

我有两个 Azure DevOps 管道: 管道 A:主管道 管道 B:公关审查管道

因此,管道 B 在我的 github 存储库中有 CI/CD,一旦发出拉取请求,就会触发管道作业。此管道仅包含 RestAPI 任务,该任务以一些模板参数作为主体调用管道 A。

问题是。 如何使用用于该特定拉取请求的 github 源分支从管道 B 触发管道 A。

谢谢

    标签: azure-devops


    【解决方案1】:

    您可以为管道 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"
    

    【讨论】:

      猜你喜欢
      • 2022-06-16
      • 1970-01-01
      • 2020-06-14
      • 2021-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-01
      • 2022-08-03
      相关资源
      最近更新 更多