基于TFS工作项信息触发构建 [英] Trigger builds based on TFS workitem information
问题描述
我目前正在寻找最佳实践,以在VSTS中实现用例
I am currently looking for best practices to implement as use case in VSTS
以下详细信息
1)我们的董事会有几个tfs工作项目,这些工作项目可以有多个状态 例如:准备构建",准备部署"等
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)根据对工作项所做的更改,是否可以触发构建?
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 ?
推荐答案
您可以使用Web钩子在工作项状态更改时触发构建.
- 与工作项状态相关的内部版本.
- 您自己的网站,以接收来自VSTS Web钩子的消息并发送请求以构建相关的内部版本.
- 在VSTS中配置Web挂钩.
- 创建与工作项状态相关的内部版本,例如
Ready to build
,Ready to deployment
等. -
配置服务挂钩:
- Create builds related to work item states as
Ready to build
,Ready to deployment
etc. Configure a service hook:
在团队项目中->服务挂钩->创建订阅-> Web挂钩->下一步->选择工作项已更新作为此类事件的触发条件->将字段过滤为状态->下一步->输入您网站的URL->测试->确保其可以成功运行->完成.
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.
使用以下功能开发自己的网站:
-
检查更新的工作项的当前状态.您可以获取一个REST API提供工作项信息,并检查
System.State
的值.
与触发器相关的构建要排队.根据System.State
的值,将不同的版本排队.例如,如果System.State
是Ready to build
,则
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.
此外,如果您正在使用TFS(Team Foundation Server),则可以在服务器上部署插件.与在Team Foundation中更改workItem时如何通知用户的方法类似Server(TFS)2015 .
这篇关于基于TFS工作项信息触发构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!