I have a azure-pipelines.yml in my repository.
It has a pr: trigger
pr:
autoCancel: true
branches:
include:
- master
paths:
exclude:
- README.md
- .gitignore
- .editorconfig
What connection does this have to Build Validation in Branch Policies?
https://docs.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops&viewFallbackFrom=vsts#build-validation
Is this the same thing?
When I remove all my build validations, creating a PR does not have any build requirements.
Is the pr: trigger a completely independent trigger from the Build Validation requirement on a Branch Policy?
If I have both a pr: trigger and a Build Validation for a Branch Policy will the build described in my .yml run twice?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
it seems that "branch policies" build validation is only for Azure DevOps/Server Git branches. For third party code repositories the "build trigger" build validation is used. Which makes sense but it would be good to have the same experience for both.
My code and build pipelines are hosted in Azure Devops - so I found the documentation around this feature to be confusing since it doesn't apply to me.
It would be really nice to define the triggers/steps for a branch policy build validation in my repository - that's where I'm already defining the triggers/steps for my build pipelines and my CI build validation is very similar stuff.
@seangwright Right now, PR triggers for Azure Repos Git are implemented using branch policies, as described here. When configuring a build validation using this branch policy, you select a Pipeline, but only the build portion of that pipeline is used, and if the selected pipeline has any other triggers specified (CI or scheduled, or even PR) they won't be used in the scope of the build validation branch policy. In that case, the branch policy controls the trigger, and the pipeline controls the build.
Is the pr: trigger a completely independent trigger from the Build Validation requirement on a Branch Policy?
Yes, completely independent, and the pr trigger is not used, and won't fire, on Azure Repos Git repos.
If I have both a pr: trigger and a Build Validation for a Branch Policy will the build described in my .yml run twice?
No, just once, because the pr trigger in the YAML won't be used.
It would be really nice to define the triggers/steps for a branch policy build validation in my repository - that's where I'm already defining the triggers/steps for my build pipelines and my CI build validation is very similar stuff.
That is a valid concern/request, I recommend that you file a feature request here and let the product team directly know. I would be happy to do it for you, but if it comes from a customer it carries more weight. You are not the only one with this suggestion (example:https://github.com/MicrosoftDocs/vsts-docs/issues/4416), and the more submissions/votes it gets, the better.
Thank you.
@steved0x Thanks for the feedback.
It looks like there is an existing request for this functionality, which I voted for, if anyone else comes across this.
When configuring a build validation using this branch policy, you select a Pipeline, but only the build portion of that pipeline is used
How do I mark the "build portion" of a YAML pipeline?
How do I mark the "build portion" of a YAML pipeline?
@laurynasr AFAIK anything under the "steps:" is the build portion of the pipeline.
Most helpful comment
How do I mark the "build portion" of a YAML pipeline?