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?

- 2,492
- 6
- 30
- 42
5 Answers
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:
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.

- 2,492
- 6
- 30
- 42
-
2everytime we create a pipeline we have to do this and it is really inconvenient – Blue Clouds Jan 07 '21 at 13:59
-
1Yes, but templates need not be registered as pipelines themselves - you just reference them as files. The error I made here was that of registering templates as pipelines and since they don't allow setting `trigger: none` they were constantly firing at every file update. – whatever Mar 09 '21 at 12:49
First you need to go to your Pipelines dashboard, then select the pipeline that you want to disable CI for it
then Click on Edit
You will be redirected to the pipeline yaml file, from there you will click on the vertical ellipsis ⋮
=> Triggers
and here you go, you can disable CI for your pipeline that easily
Save it, and you are done.

- 20,606
- 8
- 62
- 110

- 868
- 1
- 11
- 27
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.
- Pick your pipeline and double click to edit it.
- Go to the settings.
- Now you should see an option to disable. Note here we are disabling the pipeline, not just disabling trigger to the pipeline.

- 20,868
- 27
- 132
- 202
If you want to update your template without affecting pipelines which uses this template make a change on separate branch and merge it to master (or whatever you use) once you are sure that you have what you want.
The same applies if you use template from different repo:
# Repo: Contoso/WindowsProduct
# File: azure-pipelines.yml
resources:
repositories:
- repository: templates
type: github
name: Contoso/BuildTemplates
ref: refs/tags/v1.0 # optional ref to pin to
jobs:
- template: common.yml@templates # Template reference
parameters:
vmImage: 'vs2017-win2016'
By default you use template from your main branch, but you can point to any branch you want. Thus you can also test that your changes on limited pipelines as you need to point directly to a branch where you modified your template.
Let's say you have that branching:
master
|_ feature/add-extra-step
And you make a change in template but on feature/add-extra-step
by adding additional step.
Now hen you trigger pipeline which uses that template:
- trigger goes from
master
- your additional step in template won't be run - trigger goes from
feature/add-extra-step
- your additional step will be run
I made a change in template on feature/extra-step
branch:
And this is change is not avialable when I run pipeline (even the same pipeline) on master:
If you for instance don't want to trigger ci build making changes on template, pleace commit those changes with phrase [skip ci]
in th git message. Check here for more details.

- 32,704
- 10
- 78
- 107
-
1I suppose this would work but it seems to me to somehow unnecessarily complicate things up. I was thinking, is anyway a good practice to have yaml files in the same branch or repository as the source code on which they operate on? Can pipelines live in their own branch or even in a dedicated repository without any functional impact on them (e.g. ci pipelines not getting triggered when source code is updated)? – whatever Dec 11 '20 at 10:53
-
This is possible, however there is not needed. (please check repositories resources [here](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/resources?view=azure-devops&tabs=schema#resources-repositories). My idea was that you should do change on branch, not on the master. And there is better chance that you will have template in separate repo (than pipelines which build repos), because this is a great idea of sharing common stuff across all repos. Since you can apply DRY on repo level, you can move up to organization level and save efforts of keeping stuff in sync. – Krzysztof Madej Dec 11 '20 at 10:57
-
To sum up if you don't see need to have pipeline on different repo than code which it builds, don't do that. But if you use the same code in template across repos please consider creating separate repo for template and use them in pipelines. – Krzysztof Madej Dec 11 '20 at 10:58
-
Anyhow even having pipelines in their own branch or in a dedicated repo, template pipelines would still always be triggered whenever you update any yaml file including themselves. The only way I see to stop this is place some condition on stage/job execution. Weird situation. – whatever Dec 11 '20 at 11:19
-
No. If you create separate branch and apply change in template in this separate branch (all you have in the same repo), this change only affect pipeline when triggers goes from that branch. Please check me edit. Does it explain to your issue? – Krzysztof Madej Dec 11 '20 at 11:20
-
1I understand what you just now explained. What however I'm trying to say and I'm not sure you got is that since a template pipeline does not allow specifying a trigger and thus even specifying an exclude statements, it will always trigger itself each and every time you update it. – whatever Dec 11 '20 at 13:49
-
1If you do not want to trigger pipeline just add `[skip ci]` in the git comment. – Krzysztof Madej Dec 11 '20 at 14:06