Necktschnagge
Necktschnagge

Reputation: 417

Exclude branches from build (Azure Pipelines)

I want to exclude branches from build by Azure Pipelines. I do not want to specify this within the configuration on the web platform of Azure. Instead I want to specify this inside the azure-pipeline.yml. So what I did is this:

trigger:
  branches:
    include:
    - '*'
    exclude:
    - artifacts

strategy:
  matrix:
    ubuntu_16_04_gcc_8:
      imageName: 'ubuntu-16.04'
      CC: gcc-8
      CXX: g++-8
      the_name: 'Azure Pipelines'

    windows_2019:
      imageName: 'windows-2019'
      the_name: 'Azure Pipelines'

pool:
  vmImage: $(imageName)
  name: $(the_name)


steps:
 - script: git submodule update --init --recursive
   displayName: "Init Git Submodules"
   condition: succeeded()
 - script: cmake -S . -B ./build/
   displayName: "CMake: Create Project"
   condition: succeeded()
# and some more steps here

The expected behavior is that no builds are started for branch artifacts. But actually builds are still triggered. How do I need to change the yml to achieve the expected behavior?

Upvotes: 0

Views: 1131

Answers (1)

Leo Liu
Leo Liu

Reputation: 76760

The expected behavior is that no builds are started for branch artifacts. But actually builds are still triggered. How do I need to change the yml to achieve the expected behavior?

I test your YAML file, but did not reproduce your problem.

To resolve this issue, please check following suggestion:

  • Check the YAML file under the artifacts branch. If I set trigger in the artifacts like this:

     trigger:
       branches:
         include:
         - '*'
    

    The pipeline will always be triggered, no matter how you set the trigger in azure-pipeline.yml.

  • Check the Triggers setting on the trigger tab, to check if you check the checkbox Override the YAML continuous integration trigger from here:

    enter image description here

Upvotes: 1

Related Questions