Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS build, one build for many branches

We use TFS source control and have two build controllers (one VS2010 the other VS2012). We use the default build workflow template bar a few custom changes.

As we have many branches, how would we go about changing the workspace based on the desired branch?

I was thinking of adding a parameter for the branch ($\oursourcecontrol\branches\main) and then just passing it as a variable in to the get workspace part of the workflow.

Or is there a better way of doing it?

like image 957
MrBeanzy Avatar asked May 29 '14 10:05

MrBeanzy


People also ask

How do I create a feature branch in TFS?

Create a new branch for your code that starts with feature/, e.g., feature/feature-123. Make a change to your code in the feature branch and commit the change. Navigate to the Pipelines menu in Azure Pipelines or TFS and select Builds. Select the build pipeline for this repo.

What is a build definition in TFS?

A build definition consists of a series of Tasks which is executed during an automated build process. Examples of the tasks can consist of running a Visual Studio Build, MS Build, executing PowerShell or Shell scripts etc. 1) To create a Build Definition, login to TFS web interface and go to the Builds TAB. Click on + to create a build definition.

How do I use a single build with multiple branches?

You can use a single build with multiple branches and skip or perform certain tasks based on conditions. Edit the azure-pipelines.yml file in your main branch, locate a task in your YAML file, and add a condition to it. For example, the following snippet adds a condition to publish artifacts task. YAML builds are not yet available on TFS.

What is Team Foundation Server (TFS)?

We will now take a look at how Team Foundation Server (TFS) will be used to Build, Test and Deploy .NET Web Applications which is traditionally the strength of the tool. Microsoft Visual Studio .NET 2015 (30-day trial version)


1 Answers

You currently can't and it is really a shame. It would completely break the Trigger support for CI and Gates checkins. You can use the TFS Community Build Manager to quickly clone and adjust build definitions to support multiple branches though.

What you could do, is to fetch more than you need (say $/Sourcecontrol/Branches/*) and then use a string-replace on any path parameter (like solutions to build, test settings file etc) to point them all to the correct solution. You'll probably need to do some templating like {BRANCH} so that you can easily replace these tokens.

The Git build template does support this on a Git repository, but you'd need TFS 2013 to make use of server side Git support.

like image 198
jessehouwing Avatar answered Oct 17 '22 18:10

jessehouwing