在 azure DevOps YML 流水线中,是否可以从流水线 B stageY 触发流水线 A stage1?
答案 0 :(得分:1)
您可以使用 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)
...