当使用 YAML 完成另一个管道时尝试触发 Azure 管道。有文档 https://github.com/microsoft/azure-pipelines-yaml/blob/master/design/pipeline-resources.md表明您可以使用以下命令添加管道资源:
resources: # types: pipelines | builds | repositories | containers | packages
pipelines:
- pipeline: string # identifier for the pipeline resource
connection: string # service connection for pipelines from other Azure DevOps organizations
project: string # project for the source; optional for current project
source: string # source defintion of the pipeline
version: string # the pipeline run number to pick the artifact, defaults to Latest pipeline successful across all stages
branch: string # branch to pick the artiafct, optional; defaults to master branch
tags: string # picks the artifacts on from the pipeline with given tag, optional; defaults to no tags
然而,我一直无法弄清楚“来源”是什么意思。例如,我有一个名为myproject.myprogram
:
resources:
pipelines:
- pipeline: myproject.myprogram
source: XXXXXXXX
此外,还不清楚如何基于此构建触发器。
我知道这可以从 Web-GUI 完成,但应该可以从 YAML 完成。
用于从另一位azure官方触发一条管道建议以下解决方案。即使用管道触发器
resources:
pipelines:
- pipeline: RELEASE_PIPELINE # any arbitrary name
source: PIPELINE_NAME. # name of the pipeline shown on azure UI portal
trigger:
branches:
include:
- dummy_branch # name of branch on which pipeline need to trigger
但实际上发生的是它触发了两个管道。举个例子,假设我们有两个管道 A 和 B,我们希望在 A 完成时触发 B。因此,在这种情况下,B 运行 2 次,一次是在您执行提交时(与 A 并行),第二次是在 A 完成后运行。
为了避免这种情况两次管道运行问题请遵循以下解决方案
trigger: none # add this trigger value to none
resources:
pipelines:
- pipeline: RELEASE_PIPELINE # any arbitrary name
source: PIPELINE_NAME. # name of the pipeline shown on azure UI portal
trigger:
branches:
include:
- dummy_branch # name of branch on which pipeline need to trigger
通过增加触发:无第二个管道不会在开始提交时触发,仅在第一次完成其作业时触发。
希望它会有所帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)