24

My current implementation of Azure pipelines is to trigger only when a pull request is made to Develop branch. But, I want to run the pipeline on every new push on any branch. How to trigger that?

My current implementation of the Azure YAML file

trigger:
  - none
pr:
  - branches:
      include:
        - dev

and below that steps are configured.

artois
  • 485
  • 1
  • 6
  • 13

3 Answers3

45

You need to specify the trigger something like this. So for example, if there is anything pushed in dev branch a build will get triggered. Ref

trigger:
- dev

or to be more explicit:

trigger:
  branches:
    include:
    - dev
    - another-branch

If no triggers are specified it will by default run for all branches. It can be explicitly defined as:

trigger:
  branches:
    include:
    - '*'
Yogi
  • 9,174
  • 2
  • 46
  • 61
  • Yes, that is for the specific branch, but I want to trigger a pipeline for any branch, where a new push is made – artois Jan 29 '21 at 13:45
  • @artois - If you do not specify any specific, it will be triggered for all branches by default. Updated my answer. – Yogi Jan 29 '21 at 14:03
  • Is that the correct indentation for the '- ' parts? – Siete Jun 03 '22 at 11:34
  • Also make sure that "Override the YAML continuous integration trigger from here" is unchecked under Pipeline > Triggers in Azure Devops. – Asbjørn Sep 30 '22 at 07:10
4

In my case, using Azure DevOps, I have this on my .yaml file:

trigger:
- '*'
pool:
  vmImage: 'windows-latest'

So, it gets triggered no matter to which branch I'm pushing to. I hope it might help.

Note: the pool part is not relevant; I just added to give more context.

Sebastian Inones
  • 1,561
  • 1
  • 19
  • 32
0

If you have git and a repo created in your project, you can easily connect git to azure dev ops. So let's say you want to deploy every push you give to the master branch of your repo. You can connect your master branch to the azure DevOps so it deploys it automatically.

This link will provide additional information