外部回购更改时 VSTS 触发构建
VSTS Trigger Build when external repo changes
假设我有 2 个独立的存储库:RepoFrontEnd 和 RepoBackEnd。当 RepoFrontEnd 更改(并构建)时,需要重建另一个 BackEndRepo。如何设置这样的触发器?
您可以使用 Web Hooks and use Code pushed event to trigger sending information to a URL (such as a website you developed), after receive the information you can send queue a build by REST API。详细步骤为:
- 开发一个网站,具有接收信息和接收信息后排队构建BackEndRepo的功能
- 为包含 RepoFrontEnd 存储库的项目创建网络挂钩。在 Service Hooks 选项卡 (https://account.visualstudio.com/project/_apps/hub/ms.vss-servicehooks-web.manageServiceHooks-project) -> 创建订阅 -> Web Hooks -> 下一步 -> select 代码推送 用于此类事件的 Tigger -> select RepoFrontEnd for repository -> Next -> 将 URL 设置为接收信息的网站 URL -> Test(检查是否正常) -> 完成。
- 为 RepoFrontEnd 构建定义启用 CI 构建。
现在任何更改都会推送到 RepoFrontEnd,将触发 RepoFrontEnd 和 BackEndRepo 的构建。
这实际上是通过 Trigger Build Task 完成的,您可以在 VSTS Marketplace 中找到它。
它的作用是启用构建链接。而这正是我所需要的。因此,有了 RepoFrontEnd 的这个任务,当它的构建完成时,它会触发 RepoBackEnd 构建。
假设我有 2 个独立的存储库:RepoFrontEnd 和 RepoBackEnd。当 RepoFrontEnd 更改(并构建)时,需要重建另一个 BackEndRepo。如何设置这样的触发器?
您可以使用 Web Hooks and use Code pushed event to trigger sending information to a URL (such as a website you developed), after receive the information you can send queue a build by REST API。详细步骤为:
- 开发一个网站,具有接收信息和接收信息后排队构建BackEndRepo的功能
- 为包含 RepoFrontEnd 存储库的项目创建网络挂钩。在 Service Hooks 选项卡 (https://account.visualstudio.com/project/_apps/hub/ms.vss-servicehooks-web.manageServiceHooks-project) -> 创建订阅 -> Web Hooks -> 下一步 -> select 代码推送 用于此类事件的 Tigger -> select RepoFrontEnd for repository -> Next -> 将 URL 设置为接收信息的网站 URL -> Test(检查是否正常) -> 完成。
- 为 RepoFrontEnd 构建定义启用 CI 构建。
现在任何更改都会推送到 RepoFrontEnd,将触发 RepoFrontEnd 和 BackEndRepo 的构建。
这实际上是通过 Trigger Build Task 完成的,您可以在 VSTS Marketplace 中找到它。
它的作用是启用构建链接。而这正是我所需要的。因此,有了 RepoFrontEnd 的这个任务,当它的构建完成时,它会触发 RepoBackEnd 构建。