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

index 3175c3cdc0fc444c9d111fb0688aae6df1c2ba8e..d01ecd9e36bf57c06364627a5c5b398d3373d001 100644 (file)
@@ -1,8 +1,13 @@
 [general]
 title = OpenWrt Project
 title_url = http://openwrt.org/
-buildbot_url = http://phase2.builds.openwrt.org/
 workdir = /buildbot
+
+[phase2]
+buildbot_url = http://phase2.builds.openwrt.org/
+status_bind = tcp:8011:interface=127.0.0.1
+status_user = example
+status_password = example
 port = 9990
 persistent = false
 git_ssh = true
@@ -13,11 +18,6 @@ git_ssh_key = -----BEGIN RSA PRIVATE KEY-----
        nSI+JbmAAF9vw6gj2i+Hqx7UloRd0tEv/leX354T5lO06LMiNhvN9g==
        -----END RSA PRIVATE KEY-----
 
-[status]
-bind = tcp:8011:interface=127.0.0.1
-user = example
-password = example
-
 [repo]
 url = https://git.openwrt.org/openwrt/openwrt.git
 branch = master
@@ -47,11 +47,13 @@ key = RWRCSwAAA...OihABfuLvGRVfVaJ6wLf0=
 comment = Unattended build signature
 
 [slave 1]
+phase = 2
 name = slave-example-1
 password = example
 builds = 1
 
 [slave 2]
+phase = 2
 name = slave-example-2
 password = example2
 builds = 3
index 071bf315f2c98f36ea58b19e6aca0bdad161b757..753fca845cdb732e567639d8017f049b86b3502f 100644 (file)
@@ -12,7 +12,7 @@ from buildbot import locks
 ini = ConfigParser.ConfigParser()
 ini.read(os.getenv("BUILDMASTER_CONFIG", "./config.ini"))
 
-buildbot_url = ini.get("general", "buildbot_url")
+buildbot_url = ini.get("phase2", "buildbot_url")
 
 # This is a sample buildmaster config file. It must be installed as
 # 'master.cfg' in your buildmaster's base directory.
@@ -35,17 +35,17 @@ tree_expire = 0
 git_ssh = False
 git_ssh_key = None
 
-if ini.has_option("general", "port"):
-       slave_port = ini.getint("general", "port")
+if ini.has_option("phase2", "port"):
+       slave_port = ini.getint("phase2", "port")
 
-if ini.has_option("general", "persistent"):
-       persistent = ini.getboolean("general", "persistent")
+if ini.has_option("phase2", "persistent"):
+       persistent = ini.getboolean("phase2", "persistent")
 
-if ini.has_option("general", "other_builds"):
-       other_builds = ini.getint("general", "other_builds")
+if ini.has_option("phase2", "other_builds"):
+       other_builds = ini.getint("phase2", "other_builds")
 
-if ini.has_option("general", "expire"):
-       tree_expire = ini.getint("general", "expire")
+if ini.has_option("phase2", "expire"):
+       tree_expire = ini.getint("phase2", "expire")
 
 if ini.has_option("general", "git_ssh"):
        git_ssh = ini.getboolean("general", "git_ssh")
@@ -60,7 +60,8 @@ max_builds = 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 \
+                  ini.has_option(section, "phase") and ini.getint(section, "phase") == 2:
                        name = ini.get(section, "name")
                        password = ini.get(section, "password")
                        max_builds[name] = 1
@@ -589,12 +590,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("phase2", "status_bind"):
+       if ini.has_option("phase2", "status_user") and ini.has_option("phase2", "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("phase2", "status_user"), ini.get("phase2", "status_password"))]),
                        gracefulShutdown = 'auth',
                        forceBuild = 'auth', # use this to test your slave once it is set up
                        forceAllBuilds = 'auth',
@@ -603,9 +604,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("phase2", "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("phase2", "status_bind")))
 
 ####### PROJECT IDENTITY