Merge branch 'update2.9' of https://github.com/mrstanwell/buildbot-gitea into mrstanwell-update2.9

This commit is contained in:
Marvin Pohl 2021-03-09 18:35:46 +01:00
commit 56ef5a1d78
2 changed files with 27 additions and 4 deletions

View File

@ -17,23 +17,31 @@ 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
class GiteaStatusPush(http.HttpStatusPushBase): class GiteaStatusPush(http.HttpStatusPushBase):
name = "GiteaStatusPush" name = "GiteaStatusPush"
neededDetails = dict(wantProperties=True)
ssh_url_match = re.compile(r"(ssh://)?[\w+\-\_]+@[\w\.\-\_]+:?(\d*/)?(?P<owner>[\w_\-\.]+)/(?P<repo_name>[\w_\-\.]+?)(\.git)?$") ssh_url_match = re.compile(r"(ssh://)?[\w+\-\_]+@[\w\.\-\_]+:?(\d*/)?(?P<owner>[\w_\-\.]+)/(?P<repo_name>[\w_\-\.]+?)(\.git)?$")
def checkConfig(self, baseURL, token, startDescription=None, endDescription=None,
context=None, verbose=False, wantProperties=True, **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 \
@ -87,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

View File

@ -18,7 +18,7 @@ setup(name='buildbot-gitea',
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
packages=['buildbot_gitea'], packages=['buildbot_gitea'],
requires=[ requires=[
"buildbot (>=2.0.0)" "buildbot (>=2.9.0)"
], ],
entry_points={ entry_points={
"buildbot.webhooks": [ "buildbot.webhooks": [