0
votes

I am in a situation where I have several pipelines, from which the output will be a complete solution. So I will be triggering those pipelines from a "mother" pipeline using the Azure DevOps REST API. I am succeeding to queue the pipeline and run it. But this pipeline is multi stage (DTAP).

I would like to run only a single stage. Does anyone know where I should look or what I should do?

3
Have you checked the following replies? Are they helpful?Cece Dong - MSFT

3 Answers

0
votes

This is no possible at the moment. Please check this topic - How to use ADO REST APIs to run one stage in a multi-stage YAML pipeline?

Currently no such an API to trigger the specific stage in a multi-stage YAML pipeline.

However YAML-based multi-stage pipelines can now be managed from the command line by using the az pipelines command. For example, you can setup and manage pipelines interactively from the CLI, or automate the entire setup using a script, but seems still cannot trigger the specific stage.

Here you have a feature request - REST APIs to trigger a specific stage in multi-stage YAML pipeine.

0
votes

There is no direct way to trigger only specific stages, but you can decorate each stage with a condition. And you can pass parameters (variable values) to a pipeline at queue time (also through the API).

By adding and setting the variables, you can control the condition and thus control which stage to run.

Be careful with dependencies though, any stage you depend on of course has to run as well.

0
votes

Agree with @jessehouwing. You can specify the conditions under which each stage runs. By default, a stage runs if it does not depend on any other stage, or if all of the stages that it depends on have completed and succeeded. You can customize this behavior by forcing a stage to run even if a previous stage fails or by specifying a custom condition.

Check the following example of using a custom condition:

stages:
- stage: A

- stage: B
  condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/master'))