minhtuanta
minhtuanta

Reputation: 109

How Does Pipeline Know Which Branch To Get The azure-pipeline.yml From?

In my main branch, I have the trigger property in the azure-pipeline.yml looking at the main branch only

trigger:
- main

I then created another branch called test-pipeline and in that branch, I updated the trigger to include everything:

trigger:
- '*'

Then I built the test-pipeline branch using Azure Pipeline.

Now every time I push a commit to the test-pipeline branch, the Azure Pipeline build is triggered. How does that work? I thought Azure Pipeline only looks at the main branch for config?

Upvotes: 1

Views: 449

Answers (1)

danielorn
danielorn

Reputation: 6147

How does that work? I thought Azure Pipeline only looks at the main branch for config?

No, Azure Pipelines reads the build defintion from the commits you push, not from any specific branch.

When you create a new pipeline you select a repository and specify the name of a file which includes your build definition (usually azure-pipeline.yml)

Once the pipeline is setup Azure Pipelines will evaluate every commit that is pushed to the repository. It will look into the triggers specified in azure-pipeline.yml for that particular commit and decide whether or not to start the pipeline.

What is happening in your case is that you are pushing a commit where the trigger is set to '*', which means regardless of what branch it will trigger a build

Upvotes: 2

Related Questions