phase1: move phase1 specific options into separate section
authorJo-Philipp Wich <jo@mein.io>
Wed, 3 Jul 2019 06:36:12 +0000 (08:36 +0200)
committerJo-Philipp Wich <jo@mein.io>
Wed, 3 Jul 2019 06:36:12 +0000 (08:36 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
phase1/config.ini.example
phase1/master.cfg

index fda7baed046fbd8ed35220ce34521b3392bbf637..eacf7a40b8e425108769b5be8b0d609810045166 100644 (file)
@@ -1,8 +1,13 @@
 [general]
 title = OpenWrt Project
 title_url = http://openwrt.org/
-buildbot_url = http://phase1.builds.openwrt.org/
 workdir = /buildbot
+
+[phase1]
+buildbot_url = http://phase1.builds.openwrt.org/
+status_bind = tcp:8010:interface=127.0.0.1
+status_user = example
+status_password = example
 expire = 1209600
 port = 9989
 cc_version = le 4.9
@@ -20,11 +25,6 @@ config_seed = # Seed configuration
        CONFIG_KERNEL_KALLSYMS=y
        CONFIG_AUTOREMOVE=y
 
-[status]
-bind = tcp:8010:interface=127.0.0.1
-user = example
-password = example
-
 [irc]
 host = irc.freenode.net
 port = 6667
@@ -58,11 +58,13 @@ key = RWRCSwAAA...OihABfuLvGRVfVaJ6wLf0=
 comment = Unattended build signature
 
 [slave 1]
+phase = 1
 name = example-slave-1
 password = example
 builds = 3
 
 [slave 2]
+phase = 1
 name = example-slave-2
 password = example2
 builds = 1
index fa1b6b041c9f3c55f92ceafe804b2d6e595673bc..676bfe2235680a15fadeb8016237ba914abaec15 100644 (file)
@@ -34,7 +34,7 @@ c['titleURL'] = ini.get("general", "title_url")
 # with an externally-visible host name which the buildbot cannot figure out
 # without some help.
 
-c['buildbotURL'] = ini.get("general", "buildbot_url")
+c['buildbotURL'] = ini.get("phase1", "buildbot_url")
 
 ####### BUILDSLAVES
 
@@ -45,15 +45,16 @@ from buildbot.buildslave import BuildSlave
 
 slave_port = 9989
 
-if ini.has_option("general", "port"):
-       slave_port = ini.getint("general", "port")
+if ini.has_option("phase1", "port"):
+       slave_port = ini.getint("phase1", "port")
 
 c['slaves'] = []
 NetLocks = dict()
 
 for section in ini.sections():
        if section.startswith("slave "):
-               if ini.has_option(section, "name") and ini.has_option(section, "password"):
+               if ini.has_option(section, "name") and ini.has_option(section, "password") and \
+                  (not ini.has_option(section, "phase") or ini.getint(section, "phase") == 1):
                        sl_props = { 'dl_lock':None, 'ul_lock':None, 'do_cleanup':False, 'max_builds':1, 'shared_wd':False }
                        name = ini.get(section, "name")
                        password = ini.get(section, "password")
@@ -108,14 +109,14 @@ config_seed = ""
 git_ssh = False
 git_ssh_key = None
 
-if ini.has_option("general", "expire"):
-       tree_expire = ini.getint("general", "expire")
+if ini.has_option("phase1", "expire"):
+       tree_expire = ini.getint("phase1", "expire")
 
-if ini.has_option("general", "other_builds"):
-       other_builds = ini.getint("general", "other_builds")
+if ini.has_option("phase1", "other_builds"):
+       other_builds = ini.getint("phase1", "other_builds")
 
-if ini.has_option("general", "cc_version"):
-       cc_version = ini.get("general", "cc_version").split()
+if ini.has_option("phase1", "cc_version"):
+       cc_version = ini.get("phase1", "cc_version").split()
        if len(cc_version) == 1:
                cc_version = ["eq", cc_version[0]]
 
@@ -127,8 +128,8 @@ if ini.has_option("general", "git_ssh_key"):
 else:
        git_ssh = False
 
-if ini.has_option("general", "config_seed"):
-       config_seed = ini.get("general", "config_seed")
+if ini.has_option("phase1", "config_seed"):
+       config_seed = ini.get("phase1", "config_seed")
 
 repo_url = ini.get("repo", "url")
 repo_branch = "master"
@@ -1170,12 +1171,12 @@ c['status'] = []
 from buildbot.status import html
 from buildbot.status.web import authz, auth
 
-if ini.has_option("status", "bind"):
-       if ini.has_option("status", "user") and ini.has_option("status", "password"):
+if ini.has_option("phase1", "status_bind"):
+       if ini.has_option("phase1", "status_user") and ini.has_option("phase1", "status_password"):
                authz_cfg=authz.Authz(
                        # change any of these to True to enable; see the manual for more
                        # options
-                       auth=auth.BasicAuth([(ini.get("status", "user"), ini.get("status", "password"))]),
+                       auth=auth.BasicAuth([(ini.get("phase1", "status_user"), ini.get("phase1", "status_password"))]),
                        gracefulShutdown = 'auth',
                        forceBuild = 'auth', # use this to test your slave once it is set up
                        forceAllBuilds = 'auth',
@@ -1184,9 +1185,9 @@ if ini.has_option("status", "bind"):
                        stopAllBuilds = 'auth',
                        cancelPendingBuild = 'auth',
                )
-               c['status'].append(html.WebStatus(http_port=ini.get("status", "bind"), authz=authz_cfg))
+               c['status'].append(html.WebStatus(http_port=ini.get("phase1", "status_bind"), authz=authz_cfg))
        else:
-               c['status'].append(html.WebStatus(http_port=ini.get("status", "bind")))
+               c['status'].append(html.WebStatus(http_port=ini.get("phase1", "status_bind")))
 
 
 from buildbot.status import words