Reputation: 137
I have a azure-pipelines.yaml
Pipeline A
for my .NET Application with 3 stages.
Stage 1: Restore, Build, Unit test, Publish artifact
Stage 2: Consume artifact, build Docker image, push it to Artifact Repository
Stage 3: Perform bash script
This works fine with normal Continuous Integration-trigger, but now I would like to add PR-trigger too.
Is it possible to only perform Stage 1
(only restore, build, unit test, publish artifact) with PR then put it "on hold" until the PR is completed. And after completion, continue with Stage 2
and consume the published artifact and continue build docker image etc?
Or am I better off setting up a completely new pipeline?
Thanks for any guidance!
Upvotes: 1
Views: 3273
Reputation: 40849
This is not possible. However IMHO you don't need this. All what you need to do is to run first stage on PR trigger to validate state of your code. And then when it is merged to main branch, the CI trigger picks this up and runs all stages.
To limit first stage to just PR trigger you need to use this condition on stage level:
and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
Please add this to 2nd and 3rd stage.
Upvotes: 3