Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I manually trigger a single job in Azure Pipelines?

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

like image 986
Tobias von Falkenhayn Avatar asked Feb 01 '20 10:02

Tobias von Falkenhayn


1 Answers

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

like image 51
Eric Smith Avatar answered Nov 14 '22 19:11

Eric Smith