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?
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.
trigger: none
they were constantly firing at every file update. –
Pelage 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.
trigger: none
they were constantly firing at every file update. –
Pelage 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.
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.
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.
[skip ci]
in the git comment. –
Cirri There are no less than three spots in Azure DevOps that may be used to disable automatic build. Which one do you use to disable the irritating automatic builds that occur? Not sure
Firstly, Pipeline triggers as described here. I had to disable this to stop GitHub kicking off an automatic pipeline for PR's https://mcmap.net/q/327128/-azure-devops-how-to-disable-ci-trigger-on-a-yaml-template-pipeline
Confusingly this isn't in the immediate pipeline hamburger menu, it's under "Edit" then hamburger/triggers. As far as I can tell it doesn't change any source code but it does request a commit message. So much for YAML being the one true definition of deployment
Secondly, In Project/Settings there's a switch for "Disable implied YAML CI trigger".
Thridly, trigger: none
in the YAML itself. This being the only actual area where your config is captured in Git
© 2022 - 2024 — McMap. All rights reserved.