1 |
commit: 584e5b5dd357706b1d1614ccc393ba367def5eaa |
2 |
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Dec 30 08:20:41 2020 +0000 |
4 |
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Dec 30 08:21:24 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=584e5b5d |
7 |
|
8 |
Add GentooCiService |
9 |
|
10 |
Signed-off-by: Magnus Granberg <zorry <AT> gentoo.org> |
11 |
|
12 |
buildbot_gentoo_ci/config/service.py | 43 ++++++++++++++++++++++++++++++++++++ |
13 |
master.cfg | 6 +++-- |
14 |
2 files changed, 47 insertions(+), 2 deletions(-) |
15 |
|
16 |
diff --git a/buildbot_gentoo_ci/config/service.py b/buildbot_gentoo_ci/config/service.py |
17 |
new file mode 100644 |
18 |
index 0000000..af283b5 |
19 |
--- /dev/null |
20 |
+++ b/buildbot_gentoo_ci/config/service.py |
21 |
@@ -0,0 +1,43 @@ |
22 |
+# Copyright 2020 Gentoo Authors |
23 |
+# Distributed under the terms of the GNU General Public License v2 |
24 |
+ |
25 |
+from twisted.python import log |
26 |
+from twisted.internet import reactor, defer |
27 |
+ |
28 |
+from buildbot import config as master_config |
29 |
+from buildbot.db import exceptions |
30 |
+from buildbot.scripts.base import isBuildmasterDir |
31 |
+from buildbot.util.service import BuildbotService |
32 |
+from buildbot import version |
33 |
+ |
34 |
+from buildbot_gentoo_ci.db import connector as dbconnector |
35 |
+from buildbot_gentoo_ci.config import config |
36 |
+ |
37 |
+class GentooCiService(BuildbotService): |
38 |
+ |
39 |
+ name="gentooci" |
40 |
+ |
41 |
+ def checkConfig(self, basedir, **kwargs): |
42 |
+ self.basedir = basedir |
43 |
+ if not isBuildmasterDir(self.basedir): |
44 |
+ master_config.error("Can't find buildbot.tac in basedir") |
45 |
+ return |
46 |
+ |
47 |
+ @defer.inlineCallbacks |
48 |
+ def reconfigService(self, **kwargs): |
49 |
+ return defer.succeed(None) |
50 |
+ |
51 |
+ @defer.inlineCallbacks |
52 |
+ def startService(self): |
53 |
+ self.config_loader = config.FileLoader(self.basedir, 'gentooci.cfg') |
54 |
+ self.config = self.config_loader.loadConfig() |
55 |
+ self.db = dbconnector.DBConnector(self.basedir) |
56 |
+ yield self.db.setServiceParent(self) |
57 |
+ log.msg("Starting Gentoo-Ci Service -- buildbot.version: {}".format(version)) |
58 |
+ # setup the db |
59 |
+ try: |
60 |
+ yield self.db.setup(self.config) |
61 |
+ except exceptions.DatabaseNotReadyError: |
62 |
+ # (message was already logged) |
63 |
+ reactor.stop() |
64 |
+ return |
65 |
|
66 |
diff --git a/master.cfg b/master.cfg |
67 |
index 996f917..464d54d 100644 |
68 |
--- a/master.cfg |
69 |
+++ b/master.cfg |
70 |
@@ -1,6 +1,6 @@ |
71 |
# -*- python -*- |
72 |
# ex: set filetype=python: |
73 |
-from buildbot_gentoo_ci.config import schedulers, workers, builders |
74 |
+from buildbot_gentoo_ci.config import schedulers, workers, builders, service |
75 |
|
76 |
# This is a sample buildmaster config file. It must be installed as |
77 |
# 'master.cfg' in your buildmaster's base directory. |
78 |
@@ -51,7 +51,9 @@ c['builders'] = builders.gentoo_builders() |
79 |
# status of each build will be pushed to these targets. buildbot/reporters/*.py |
80 |
# has a variety to choose from, like IRC bots. |
81 |
|
82 |
-#c['services'] = [] |
83 |
+c['services'] = [ |
84 |
+ service.GentooCiService(basedir) |
85 |
+] |
86 |
|
87 |
####### PROJECT IDENTITY |