6
votes

I have a simple Azure Pipeline containing two stages:

  • Stage 1: Build
  • Stage 2: Run tests

Stage 1 builds the source code and pushes the binaries to Azure Artifacts. Stage 2 downloads the binaries of Stage 1 and runs multiple tests against them, using different jobs for different tests:

  • Job 1: Run tests for module A
  • Job 2: Run tests for module B
  • Job 3: Run tests for module C

These jobs are completely indepent of each other and run in parallel.

If all stages and jobs succeed, how can I manually trigger Job 3 in Stage 2 without triggering Stage 1 and Job 1 and 2 of Stage 2 again?

One ugly work around might be to use variables and somehow run a new pipeline, skip stage 1 if the variables are set and download the binaries from a previous pipeline. Are there better approaches?

Edit: There is a similar topic ongoing on ms dev community: https://developercommunity.visualstudio.com/idea/697467/manually-triggered-stages-in-yaml-multi-stage-pipe.html?childToView=903723#comment-903723

2
No, seems not to be possible at the moment.Tobias von Falkenhayn

2 Answers

2
votes

You can do what you are after with multi-stage pipelines if you pull the individual Jobs that exist in your current Stage 2 up into their own independent Stages.

Once you do that, you can then manually trigger them independently for reruns. enter image description here

Or if you had a need, you can also start a new run with only a subset of the stages. enter image description here

0
votes

If you define release pipeline in yaml , you can through adding condition: false to disable/skip a job in multiple-job pipeline.

- job: Foo  
  condition: false

For details , you can refer to this case.

Then you can choose which stages to run when running multi-stages pipeline ,through this, you can skip Stage1.

enter image description here