Reputation: 18168
I want my YAML build pipeline to only buid if I commit to master. Currently a commit to any branch will trigger a build.
I have Continuous Integration Enabled.
The default branch for manual and scheduled builds is master.
Under triggers I have Override the YAML continuous integration trigger unchecked
In the YAML I have
trigger:
braches:
include:
- master
pool:
vmImage: 'windows-latest'
I thought that by only having masster mentioned in the trigger section then only a commit to master should trigger the pipeline. However any commit will trigger it.
Update
I also tried excluding master but the pipeline still runs.
trigger:
branches:
include:
- azure-pipelines-ubuntu
exclude:
- master
I see that both pipelines are running the YAML in my linux branch and yet when I edit the first pipeline, by clicking the three dots and selecting edit, it opens the YAML in master
When I try running my Linux pipeline manually I get an error
Encountered error(s): Could not find valid pipeline YAML file for this branch/tag
I then select the correct branch and can run it.
I also see a message when viewing the Run.
Some recent issues detected related to pipeline triggers
When I click View Details I see a message
Configuring the trigger failed, edit and save the pipeline again
Doing that does not help.
Update
I edited a file in the azure-pipelines-linux branch via Visual Studio and committed. The resulting commit graph is
The azure-pipelines-linux.yml only exists in the azure-pipelines-linux branch.
Update
In the UI both pipelines show as being for the azure-pipelines-ubuntu branch. Yet when I edit the pipeline from Devops the correct yml loads to edit.
Editing the first pipeline from DevOps
Editing the second pipeline from DevOps
Update
When I edit the YAML I can see the branch I want in the combo box
Upvotes: 0
Views: 133
Reputation: 13944
I noticed that you have two pipelines:
azure-pipelines.yml
file.azure-pipelines-ubuntu.yml
file.If you want the pipeline of azure-pipelines.yml
file runs only for master
branch, you can:
azure-pipelines.yml
file.
trigger:
branches:
include:
- master
azure-pipelines.yml
file with this CI configuration is existing in master
branch.azure-pipelines.yml
file can be not existing. If exists, ensure it has the same configuration of CI trigger.Similarly, if you want the pipeline of azure-pipelines-ubuntu.yml
file runs only for azure-pipelines-ubuntu
branch, you can:
azure-pipelines-ubuntu.yml
file.
trigger:
branches:
include:
- azure-pipelines-ubuntu
azure-pipelines-ubuntu.yml
file with this CI configuration is existing in azure-pipelines-ubuntu
branch.azure-pipelines-ubuntu.yml
file can be not existing. If exists, ensure it has the same configuration of CI trigger.Upvotes: 1