'Is there a way to call another pipeline from stage?

I got 2 pipelines: A and B. In pipeline A I got 2 stages: A1, A2. I would like pipeline B to be called after stage A1 finished and stage A2 needs to wait for external pipeline to complete (in a synchronous manner).

On the timeline it would like like this:

  1. Pipeline A starts
  2. Stage A1 starts and finishes
  3. External pipeline is invoked
  4. Stage A2 starts when external pipeline finished successfully

Tried putting resources section like this in pipeline A, but it didn't work:

resources:

  pipelines:
      - pipeline: pipeline-B
        source: pipeline-B
        trigger:
          stages: 
            - StageA1


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source