How can I build from specific branch in Azure Devops?

Viewed 9223

I'm new to GIT but have used VSTS for a while. I want to build/deploy from specific branches. I read this:

YAML PR triggers are only supported in GitHuib and Bitbucket Cloud. If you are using Azure Repos Git you can configure a branch policy for build validation in order to trigger your build pipeline for validation.

I read about branch policies, but I am not seeing the connection. All I want is to create a build pipeline for my develop branch and another one for my staging branch. Can someone please explain how to accomplish this?

1 Answers

Do you want to use the develop and staging branches as target branches,then trigger the build when a pr merged from the source branch to the target branch is created ?

If so, first you need to set up Build validation in the branch policy of the develop/staging branch. Then select the build pipeline you want pr to trigger in the Build pipeline drop-down list of Add build policy dialog.

enter image description here

If you just want to build from specific branch,as Daniel said ,you only need to select which branch to run when running pipeline.

enter image description here

Related