pythongithubgithub-apibuildbot

How to use GitHubCommentPush in BuildBot


I'm trying to add an automatic feedback from BuildBot to a github pull request using GitHubCommentPush

But I constantly get an error:

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

Apparently my GitHub token is not a valid .

I have no idea what kind of token the buildbot wants.

None of these points helped me.

Can anyone explain how this should work?

Here is the code for how I connect the service.

        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)

Solution

  • It is bug of buildBot version 2.3.1.

    Fixed PR