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:
parent
cd82223a81
commit
a47f7a512b
|
@ -17,6 +17,7 @@ from buildbot.process.results import SUCCESS
|
||||||
from buildbot.process.results import WARNINGS
|
from buildbot.process.results import WARNINGS
|
||||||
from buildbot.reporters import http
|
from buildbot.reporters import http
|
||||||
from buildbot.util import httpclientservice
|
from buildbot.util import httpclientservice
|
||||||
|
from buildbot.warnings import warn_deprecated
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
@ -27,16 +28,20 @@ class GiteaStatusPush(http.HttpStatusPushBase):
|
||||||
|
|
||||||
def checkConfig(self, baseURL, token, startDescription=None, endDescription=None,
|
def checkConfig(self, baseURL, token, startDescription=None, endDescription=None,
|
||||||
context=None, verbose=False, wantProperties=True, **kwargs):
|
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
|
@defer.inlineCallbacks
|
||||||
def reconfigService(self, baseURL, token,
|
def reconfigService(self, baseURL, token,
|
||||||
startDescription=None, endDescription=None,
|
startDescription=None, endDescription=None,
|
||||||
context=None, context_pr=None, verbose=False,
|
context=None, context_pr=None, verbose=False, wantProperties=True,
|
||||||
warningAsSuccess=False, **kwargs):
|
warningAsSuccess=False, **kwargs):
|
||||||
|
|
||||||
token = yield self.renderSecrets(token)
|
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 = context or Interpolate('buildbot/%(prop:buildername)s')
|
||||||
self.context_pr = context_pr or \
|
self.context_pr = context_pr or \
|
||||||
|
@ -90,6 +95,21 @@ class GiteaStatusPush(http.HttpStatusPushBase):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def send(self, build):
|
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 = Properties.fromDict(build['properties'])
|
||||||
props.master = self.master
|
props.master = self.master
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user