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
1.1k views
in Technique[技术] by (71.8m points)

azure devops - Trigger builds based on TFS workitem information

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 ?

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

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.


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

...