Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
635 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 Reply

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...