Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to chain builds in TFS 2015?

Is there a way in TFS 2015 to have two builds such that the second build gets triggered whenever the first one finishes (successfully)? There are solutions for the old XAML based build system, but nothing for the new script-based system, which is what I'm using.

like image 590
Frederick The Fool Avatar asked Dec 10 '22 21:12

Frederick The Fool


1 Answers

I achieved the "chaining" of builds by creating a custom BuildTask which basically just makes the appropriate calls to the TFS REST Api. It allows me then to define a build definition (by name) that I want to trigger and on top add some conditions (for example check if there is a build of this definition already queued or check if the last build of a certain definition was successful).

If there is any interest, I uploaded the source code to github.

Using tfx you can upload the task to your TFS see details here
In short just grab the files from github, install tfx via node and run

tfx build tasks upload --task-path ./triggerbuildtask

After this you can select the Trigger new Build Task and configure it: enter image description here

Hope this may help some people that try to achieve the same thing.

Edit
I packaged the task and published it on the Marketplace, so it makes it easy to use the task in your environment:
Trigger Build Task

like image 124
huserben Avatar answered Feb 27 '23 10:02

huserben