1

I am trying to configure build definition in the Visual Studio team services. Is it possible to get the sources from specific branch in Get Sources task. For instance I can enable CI in two branches i.e. master & develop but I can only choose either master or develop in get sources. So I am now keeping two build definition one for master and another for develop. Is it possible to keep only one build definition to easy maintenance.

I am using git and I am confused with the below branch selection (1) when I have already selected branches (2)

enter image description here enter image description here

Shiju Samuel
  • 1,373
  • 6
  • 22
  • 45

1 Answers1

4

Assuming you're using Git, you're choosing the default branch. That doesn't mean that it's the only branch that can be built by that build definition.

You can choose which branches to monitor for CI (on the Triggers tab, you can add multiple branch filters to represent the branches you wish to build on commit), and the appropriate branch will be checked out when the build is triggered. You can also choose an alternate branch when manually queuing the build.

If you're using TFVC, it's basically impossible to have CI configured for multiple branches from the same build definition.

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120
  • Are you sure about this latter? I have done magic playing with workspace mapping. – Giulio Vian Jul 13 '17 at 08:39
  • @GiulioVian You can map the branches in the same workspace, but there's no way to distinguish what branch should be built, so you have to build everything. And you have the same problem for release definitions. No idea which branch triggered the build, so no idea which set of artifacts to use. It's a mess. – Daniel Mann Jul 14 '17 at 03:53
  • Ok, thanks,now I get that you referred to build _triggers_. – Giulio Vian Jul 14 '17 at 05:34