Conform to code in GitLabStatusPush v2.9.4.

I don't fully understand the impact of these API changes, but without
them the status from buildbot upon a successful build was causing gitea
to mark commits with a yellow circle instead of a green checkmark.
Since GiteaStatusPush was based on GitLabStatusPush in the first place,
I tried making it look more like its ancestor -- and now the commit status
in gitea is working correctly.
This commit is contained in:
mrstanwell 2021-01-08 15:49:39 -06:00
parent cd82223a81
commit a47f7a512b
1 changed files with 23 additions and 3 deletions

View File

@ -17,6 +17,7 @@ from buildbot.process.results import SUCCESS
from buildbot.process.results import WARNINGS
from buildbot.reporters import http
from buildbot.util import httpclientservice
from buildbot.warnings import warn_deprecated
import re
@ -27,16 +28,20 @@ class GiteaStatusPush(http.HttpStatusPushBase):
def checkConfig(self, baseURL, token, startDescription=None, endDescription=None,
context=None, verbose=False, wantProperties=True, **kwargs):
super().checkConfig(wantProperties=wantProperties, **kwargs)
super().checkConfig(wantProperties=wantProperties,
_has_old_arg_names={
'builders': False,
'wantProperties': wantProperties is not True
}, **kwargs)
@defer.inlineCallbacks
def reconfigService(self, baseURL, token,
startDescription=None, endDescription=None,
context=None, context_pr=None, verbose=False,
context=None, context_pr=None, verbose=False, wantProperties=True,
warningAsSuccess=False, **kwargs):
token = yield self.renderSecrets(token)
yield http.HttpStatusPushBase.reconfigService(self, **kwargs)
yield super().reconfigService(wantProperties=wantProperties, **kwargs)
self.context = context or Interpolate('buildbot/%(prop:buildername)s')
self.context_pr = context_pr or \
@ -90,6 +95,21 @@ class GiteaStatusPush(http.HttpStatusPushBase):
@defer.inlineCallbacks
def send(self, build):
# the only case when this function is called is when the user derives this class, overrides
# send() and calls super().send(build) from there.
yield self._send_impl(build)
@defer.inlineCallbacks
def sendMessage(self, reports):
build = reports[0]['builds'][0]
if self.send.__func__ is not GiteaStatusPush.send:
warn_deprecated('2.9.0', 'send() in reporters has been deprecated. Use sendMessage()')
yield self.send(build)
else:
yield self._send_impl(build)
@defer.inlineCallbacks
def _send_impl(self, build):
props = Properties.fromDict(build['properties'])
props.master = self.master