简体   繁体   中英

Azure DevOps Pipelines - PR trigger only run one stage, after complete continue

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!

This is not possible. However IMHO you don't need this. All waht you need to is to run first stage on PR trigger to validate state of you code. And then when it marge to main branch, the CI trigge rpicks 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM