Trigger builds based on TFS workitem information

2020-02-15 06:41发布

I am currently looking for best practices to implement as use case in VSTS

Details below

1) Our board has several tfs work items and these work items can have multiple states example : 'Ready for build', 'Ready for deployment' etc

2) Based on the changes made to work item, is it possible to trigger a build ?

For example if the workitem is moved to 'Ready for deployment' state, a deployment build should be triggered

In other words how can we trigger builds based on changes to a work item ?

1条回答
ゆ 、 Hurt°
2楼-- · 2020-02-15 06:58

You can use web hook to trigger builds when work item states are changes.

Prerequisites as below:

  • Build related to work item states.
  • Your own website to receive message from VSTS web hook and send request to build related builds.
  • Config a web hook in VSTS.

Detail steps as below:

  1. Create builds related to work item states as Ready to build, Ready to deployment etc.
  2. Configure a service hook:

    In the team project -> Services Hooks -> Create subscription -> Web Hooks -> Next -> select Work item updated as trigger on this type of event -> filter Field as State -> Next -> input your website’s URL -> Test -> make sure it can work successful -> Finish.

  3. Develop your own website with below functions:

    • Check the current state of the work item updated. You can get a work item information by REST API, and the check the value for System.State.

    • Trigger related build to queue. According to the value of System.State, queue different builds. Such as if System.State is Ready to build, then queue the build for this state.


Besides, If you are using TFS (Team Foundation Server), you can deploy a plugin on the server. Similar as the method in How to notify users when workItem is changed in Team Foundation Server(TFS) 2015.

查看更多
登录 后发表回答