Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure DevOps : how to disable CI trigger on a YAML template pipeline?

In template pipelines you can't place any trigger statement such as trigger: none as specified in Microsoft's docs to disable ci trigger, so I wonder how do you prevent these pipelines from being executed every time you update them or any other yaml file in the same branch?

like image 654
whatever Avatar asked Dec 11 '20 09:12

whatever


People also ask

How do I disable CI in Azure DevOps?

Navigate to your team project on Azure DevOps. Navigate to Pipelines | Pipelines. Not to have two pipelines triggered later in the lab, disable the CI trigger for the template created pipeline (uncheck) and Save.

How do I disable a task in YAML pipeline?

You can try set variables : enabled = false , then use the variable in YAML file. If set this way, this task will not run in the job.

What is trigger in YAML file?

Continuous deployment triggers help you start classic releases after a classic build or YAML pipeline completes. Scheduled release triggers allow you to run a release pipeline according to a schedule. Pull request release triggers are used to deploy a pull request directly using classic releases.

How do you trigger release pipeline from build pipeline Azure DevOps?

Stages filters for pipeline resource triggers requires Azure DevOps Server 2020 Update 1 or greater. You can trigger your pipeline when one or more stages of the triggering pipeline complete by using the stages filter. If you provide multiple stages, the triggered pipeline runs when all of the listed stages complete.

How do I disable triggering of a Azure DevOps build pipeline?

how do I disable triggering of a Azure DevOps build pipeline every time it is saved? You can opt out of CI triggers entirely by specifying trigger: none. Or you could set the specify trigger for each pipeline by filters, like: CI triggers, Batching CI runs, Paths:

How to disable a trigger in a YAML based build pipeline?

I have a yaml based build pipeline. I did not want to touch the yaml just for disabling the trigger. So I disabled the pipeline as follows. Pick your pipeline and double click to edit it. Go to the settings. Now you should see an option to disable.

How to disable CI trigger in a template pipeline?

In template pipelines you can't place any trigger statement such as trigger: none as specified in Microsoft's docs to disable ci trigger, so I wonder how do you prevent these pipelines from being executed every time you update them or any other yaml file in the same branch? The pipeline yaml definition now supports disabling all trigers with

What is a scheduled trigger in YAML?

Scheduled triggers are independent of the repository and allow you to run a pipeline according to a schedule. Pipeline triggers in YAML pipelines and build completion triggers in classic build pipelines allow you to trigger one pipeline upon the completion of another. Branch consideration for triggers in YAML pipelines


Video Answer


3 Answers

The pipeline yaml definition now supports disabling all trigers with

trigger: none

Reference

like image 159
Mifeet Avatar answered Oct 17 '22 15:10

Mifeet


So in the end in a template pipeline you can't state something like trigger: none (to set only manual triggering) and you cannot specify stages or jobs, only steps are allowed (so you can't define any condition to prevent pipeline execution on the job or on the stage).

You have an option to disable the CI trigger by going in the triggers section for the template pipeline and select the following:

enter image description here

I don't like much this option because it means having pipeline configuration that is not captured in the yaml pipeline definition but I found no other way to disable the template pipeline from being triggered every time something (including the pipeline itself) is updated in its branch.

like image 38
whatever Avatar answered Oct 17 '22 16:10

whatever


Other answers are fine.

Here is another approach I found. I have a yaml based build pipeline. I did not want to touch the yaml just for disabling the trigger. So I disabled the pipeline as follows.

  1. Pick your pipeline and double click to edit it.

Pick your pipeline and edit it

  1. Go to the settings.

Go to settings

  1. Now you should see an option to disable. Note here we are disabling the pipeline, not just disabling trigger to the pipeline.

Disable pipeline

like image 1
VivekDev Avatar answered Oct 17 '22 14:10

VivekDev