基于 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 ?
推荐答案
当工作项状态发生变化时,您可以使用网络钩子触发构建.
You can use web hook to trigger builds when work item states are changes.
- 与工作项状态相关的构建.
- 您自己的网站,用于接收来自 VSTS 网络挂钩的消息并发送构建相关构建的请求.
- 在 VSTS 中配置网络钩子.
- 创建与工作项状态相关的构建,如
准备构建
、准备部署
等 配置服务挂钩:
在团队项目中 -> 服务挂钩 -> 创建订阅 -> 网络挂钩 -> 下一步 -> 选择 工作项已更新 作为此类事件的触发器 -> 过滤字段为 状态 -> 下一步 -> 输入您网站的 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
的值.
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
.
触发相关构建到队列.根据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 时通知用户中的方法服务器(TFS)2015.
这篇关于基于 TFS 工作项信息触发构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!