Posting build errors to slack or github

浪子不回头ぞ 提交于 2020-07-09 09:19:48

问题


I am using Visual Studio Online for continuous integration. I've also enabled integration with Slack (posting build status) and GitHub (validating pull requests).

In both of these integrations I am missing one feature - posting build error log to either Slack or GitHub (for example, as a comment to the pull request). This might substantially improve reaction time, since you don't need to go to the failed build (often re-login to VSO), find errors in the log, etc.

Did any of you guys manage to get this working somehow?


回答1:


You can use web hook to return VSTS build error message to slack or do some actions (create issue, close pull request etc) on github.

Prerequisite:

Web hook for VSTS build failed.

Develop a website to receive information, queue VSTS build and close pull request on github.

Add a build definition with Post To Slack task, when your VSTS build failed, your website will queue this build.

Create web hook:

VSTS project -> Service Hooks -> Create subscription -> Web hooks -> Next -> select Build completed to trigger this event -> select your CI build definition -> set Build Status to Failed -> Next -> set your website address to URL -> test if it works for your website -> Finish.

Develop functions on your website:

After your website receiving message from web hooks, trigger below actions:

  1. Queuing the build with Post To Slack task by REST API.
  2. Close a pull request on github by REST API v3.


来源:https://stackoverflow.com/questions/44443184/posting-build-errors-to-slack-or-github

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!