繁体   English   中英

如何从 Azure DevOps 中的另一个管道触发一个管道阶段?

[英]How to trigger one pipeline stage from another pipeline in Azure DevOps?

在 azure DevOps YML 管道中,是否可以从管道 B stageY 触发管道 A stage1 ?

您可以使用Trigger Build自定义任务。 它会触发整个管道,但您可以使用阶段条件跳过不应运行的阶段。

# in pipeline A
- task: TriggerBuild@3
  displayName: 'Trigger a new build pipelineB'
  inputs:
    buildDefinition: 'pipelineB'
    waitForQueuedBuildsToFinish: true
    waitForQueuedBuildsToFinishRefreshTime: 10
    buildParameters: 'stageY: true, stageX: false, stageZ: false'
    authenticationMethod: 'OAuth Token'
    password: '$(System.AccessToken)'
# in pipeline B
variables: []  # do not define stageX, stageY, stageZ variables here, or it won't work
stages:
- stage: stageX
  condition: ne(variables.stageX, false)
  ...
- stage: stageY
  condition: ne(variables.stageY, false)
  ...
- stage: stageZ
  condition: ne(variables.stageZ, false)
  ...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM