2

I have a Repository in Azure Repos which has branches as master, build, feature. Build Branch and Feature branches have their own pipelines code in the azure-pipelines.yaml in the branch itself respectively. So that they can have their dedicated pipelines

The problem is that When I commit to the Build branch or in the feature branch then, both the pipelines are triggered.

I have written in my azure-pipelines.yml

trigger:
  branches:
    include:
        - build
    exclude:
       - feature
3
  • I have to ask, are "build" and "feature" spelled correctly?
    – Crowcoder
    May 6 '20 at 10:32
  • yes it is spelled correctly May 6 '20 at 17:05
  • Is it just feature or feature/something? Jul 21 '20 at 23:36
1

If you have set a CI trigger make sure you have set the filter to the exact branch which you need the build to be triggered and not the entire repository which is the default case.

1

You might consider using the pipeline trigger YAML override feature.

Go to the pipeline designer/editor view. Next to the "Run" button is the ellipsis. From that menu, select "Triggers". From the "Continuous Integration" section, you can choose "Override the YAML continuous integration trigger from here". Then you can tailor the pipeline triggers very specifically without the need to define them in the YAML.

3
  • Can you use wildcards like feature/* when you specify the overrides? I couldn't find that anywhere. Oct 28 '20 at 6:06
  • From what I'm seeing, you can only select a specific, existing branch. You should be able to have the build branch "include" only the build branch in the filter list. Then have the feature branch Exclude the build branch in the filter list. This should allow arbitrary feature/* branches to build only on the right pipeline.
    – Peter
    Nov 3 '20 at 3:23
  • 1
    I realized also, did you update the YAML file in all the branches? I'm not sure what branch the pipeline pulls the YAML front if not the branch for which you are requesting the build. I'm personally not a fan of having the YAML dictate what the build trigger rules are, since they can be based on branches and, of course, the YAML is an asset in the source and thus in 1 or more branches. Feels to tightly coupled to me.
    – Peter
    Nov 3 '20 at 3:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.