0

In azure DevOps YML pipelines, is it possible to trigger a pipeline A stage1 from pipeline B stageY ?

1 Answers1

2

There's a Trigger Build custom task that you can use. It triggers the whole pipeline, but you can use stage conditions to skip stages that should not run.

# 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)
  ...
qbik
  • 5,502
  • 2
  • 27
  • 33