如何在 BuildBot 中使用 GitHubCommentPush

How to use GitHubCommentPush in BuildBot

我正在尝试使用 GitHubCommentPush

将来自 BuildBot 的自动反馈添加到 github 拉取请求

但我经常收到错误消息:

2019-07-18 09: 04: 56 + 0000 [-] Timing out client: IPv4Address (type = 'TCP', host = '86 .57.157.184 ', port = 42090)
2019-07-18 09: 04: 56 + 0000 [-] Timing out client: IPv4Address (type = 'TCP', host = '86 .57.245.94 ', port = 42086)
2019-07-18 09: 04: 56 + 0000 [-] Timing out client: IPv4Address (type = 'TCP', host = '86 .57.157.184 ', port = 42092)
2019-07-18 09: 04: 56 + 0000 [-] while invoking <bound method HttpStatusPushBase.buildStarted of <buildbot.reporters.github.GitHubCommentPush object at 0x7f4ae512aa20 >>
        Traceback (most recent call last):
          File "/home/andrei/bot/sandbox/lib/python3.6/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
            result = g.send (result)
          File "/home/andrei/bot/sandbox/lib/python3.6/site-packages/buildbot/reporters/http.py", line 80, in getMoreInfoAndSend
            yield self.send (build)
          File "/home/andrei/bot/sandbox/lib/python3.6/site-packages/twisted/internet/defer.py", line 1613, in unwindGenerator
            return _cancellableInlineCallbacks (gen)
          File "/home/andrei/bot/sandbox/lib/python3.6/site-packages/twisted/internet/defer.py", line 1529, in _cancellableInlineCallbacks
            _inlineCallbacks (None, g, status)
        --- <exception caught here> ---
          File "/home/andrei/bot/sandbox/lib/python3.6/site-packages/buildbot/reporters/http.py", line 80, in getMoreInfoAndSend
            yield self.send (build)
          File "/home/andrei/bot/sandbox/lib/python3.6/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
            result = g.send (result)
          File "/home/andrei/bot/sandbox/lib/python3.6/site-packages/buildbot/reporters/github.py", line 177, in send
            content = yield response.content ()
        builtins.UnboundLocalError: local variable 'response' referenced before assignment

显然我的 GitHub 令牌无效。

我不知道 buildbot 想要什么样的令牌。

None 这些点对我有帮助。

谁能解释一下这是如何工作的?

这是我如何连接服务的代码。

        self.masterConf ['services'] = []
        self.masterConf ['secretsProviders'] = [
            secrets.SecretInAFile (dirname = "/ path / to / buildBotSecret")
        ]

        gc = reporters.GitHubCommentPush (token = util.Secret ("gitHub"),
                                         startDescription = 'Build started.',
                                         endDescription = 'Build done.')

        self.masterConf ['services']. append (gc)

根据代码,该错误意味着我们在创建响应变量之前遇到了异常。

这段代码中的错误管理非常糟糕。 所以我要做的是编辑

之前的行
            content = yield response.content()

为了先打印异常详情。

是buildBot 2.3.1版本的bug。

已修复PR