I have two pipelines in Azure Devops:
Pipeline A triggers on commits to master and produces a set of artifacts
Pipeline B triggers on successful completion of Pipeline A and consumes its artifacts
This all works correctly with just normal commits into master, however if I create a Branch Validation policy that enforces pull requests into master to run Pipeline A successfully, that PR pre-merge run of Pipeline A never triggers Pipeline B (which I want it to do for PRs as well, but its success is only optional for the PR).
If I add Pipeline B as a second branch validation directly (as an optional validation), it runs simultaneously with Pipeline A, but Pipeline B will not consume the correct artifacts because it isn't being triggered by the run it should consume from, and instead just pulls the latest artifacts available from the pipeline resource it expects to download from (which results in a race condition as Pipeline B when run simultaneously with Pipeline A will always finish first, so it downloads the N-1 artifact).
What I expected to work was:
In Pipeline B yaml:
resources:
pipelines:
- pipeline: pipelineA
source: PipelineA
trigger:
branches:
include :
- '*'
Then in the branch policy add a branch validation for Pipeline A, and a status check for Pipeline B with the status to check being 'VSTS-RM/PipelineA'. But it never triggers all the way through correctly.
Essentially what I want to do is this https://www.linkedin.com/pulse/end-to-end-pull-request-azure-devops-olivier-l%C3%A9ger where Pipeline B is just another yml build pipeline, not a release pipeline.
Is it not currently possible utilizing two build pipelines to do this?