Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
627 views
in Technique[技术] by (71.8m points)

tfsbuild - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...