Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manual Trigger on Azure Pipelines Stages (YAML)

I'm setting up a pipeline using Azure Pipelines YAML format. I have created 3 stages: Build, Staging, and Production. As the names suggest, the Build stage builds the project and publishes the build artifacts. The Staging stage deploys to the Staging environment and the Production stage deploys to the Production environment.

In the Environments section of my project, I have added a check for the Production environment so that I can approve the deployment before going live.

The way that my pipeline works is that both Staging and Production stages are triggered automatically after the Build stage is finished. What I don't like about this is that when developers deploy their code to Staging, they need a couple of days to test it on Staging before pushing their code to Production. So, until then, my pipeline keeps running and waiting for my approval. The spinner at the top-left corner keeps spinning and the "Duration" field keeps passing.

enter image description here

Is there any ways that develpers manually trigger the Production stage whenever they are ready instead of the Build stage triggering it?

like image 958
hosjay Avatar asked Nov 02 '19 01:11

hosjay


3 Answers

Manual stages in yaml pipeline is not available currently. This feature request has been submitted to Microsoft. You can go and vote it up or submit a new one.

There are workarounds to achieve this.

You can move your staging and production stages to Classic Web UI Release Pipeline. Manually trigger a stage is available in Web UI Release pipeline. Please check here for more information.

enter image description here

Another way to achieve this is to separate your yaml pipeline into two yaml pipelines(stage pipeline and production pipeline). And disable CI build for production pipeline( in the pipeline edit page, click on the 3dots on the top right corner and choose triggers. Please refer to below pics).

enter image description here

enter image description here

So that you can manually run production pipeline after Developer done with their tests.

like image 153
Levi Lu-MSFT Avatar answered Nov 08 '22 19:11

Levi Lu-MSFT


You can specify which stage you want to run.

When you click "Run pipeline", click on "Stages to run":

enter image description here

Now choose which staged will run:

enter image description here

like image 24
Shayki Abramczyk Avatar answered Nov 08 '22 19:11

Shayki Abramczyk


you can set the trigger to none to disable CI and only trigger it manual

trigger: none
like image 16
GeertvdC Avatar answered Nov 08 '22 19:11

GeertvdC