4
0
mirror of https://github.com/QuasarApp/QuasarAppCI.git synced 2025-04-28 06:34:35 +00:00
QuasarAppCI/BuildBotLib/buildBotServices.py

46 lines
1.9 KiB
Python
Raw Normal View History

2019-07-22 10:20:59 +03:00
# This Python file uses the following encoding: utf-8
2019-12-26 13:48:06 +03:00
from BuildBotLib.buildBotModule import BuildBotModule
2019-07-22 17:17:44 +03:00
from buildbot.plugins import reporters, util
2019-12-26 13:48:06 +03:00
from BuildBotLib.secretManager import SecretManager
2020-12-22 14:41:35 +03:00
from pathlib import Path
2021-03-10 19:10:30 +03:00
from buildbot.reporters.generators.build import BuildStartEndStatusGenerator
2019-07-22 10:20:59 +03:00
2019-12-26 13:48:06 +03:00
class BuildBotServices(BuildBotModule):
2020-06-19 11:09:23 +03:00
def __init__(self, masterConf):
BuildBotModule.__init__(self, masterConf)
2019-07-22 10:20:59 +03:00
2019-12-26 13:48:06 +03:00
# BUILDBOT SERVICES
2019-07-22 10:20:59 +03:00
2019-12-26 13:48:06 +03:00
# 'services' is a list of BuildbotService
# items like reporter targets. The
# status of each build will be pushed to these targets.
# buildbot/reporters/*.py
2019-07-22 10:20:59 +03:00
# has a variety to choose from, like IRC bots.
self.masterConf['services'] = []
2020-12-22 14:44:24 +03:00
secretPath = str(Path.home()) + "/buildBotSecret/secret.json"
secret = SecretManager(secretPath)
2019-07-22 10:20:59 +03:00
2021-03-10 19:10:30 +03:00
status_generator = BuildStartEndStatusGenerator(
start_formatter=reporters.MessageFormatterRenderable('Build started.'),
end_formatter=reporters.MessageFormatterRenderable('Build finished.'),
)
2019-08-21 14:34:47 +03:00
contextVal = util.Interpolate("buildbot/%(prop:buildername)s")
2021-03-10 19:10:30 +03:00
gc = reporters.GitHubStatusPush(
token=secret.getValue('gitHub'),
2019-12-26 13:48:06 +03:00
context=contextVal,
verbose=True,
2021-03-10 19:10:30 +03:00
generators=[status_generator]
)
2021-09-21 10:19:52 +03:00
gt = reporters.GiteaStatusPush(
'https://quasarapp.ddns.net:3000/',
secret.getValue('gitea'),
verbose=True,
generators=[status_generator]
)
2019-07-22 10:20:59 +03:00
self.masterConf['services'].append(gc)
2021-09-21 10:19:52 +03:00
self.masterConf['services'].append(gt)