[buildbot] phase1, phase2: update master to Debian 10 / Buildbot 2.0.1

LEDE Commits lede-commits at lists.infradead.org
Thu Jul 30 06:14:22 EDT 2020


jow pushed a commit to buildbot.git, branch master:
https://git.openwrt.org/8c4f1e48bd098694c72878d1468627921087ab71

commit 8c4f1e48bd098694c72878d1468627921087ab71
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Sun Feb 2 19:22:41 2020 +0100

    phase1, phase2: update master to Debian 10 / Buildbot 2.0.1
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 .dockerignore                 |   1 +
 docker/buildmaster/Dockerfile |  10 ++-
 phase1/buildbot.tac           |  29 ++++-----
 phase1/master.cfg             | 144 +++++++++++++++++++++---------------------
 phase2/buildbot.tac           |  29 ++++-----
 phase2/master.cfg             | 115 +++++++++++++++++----------------
 6 files changed, 161 insertions(+), 167 deletions(-)

diff --git a/.dockerignore b/.dockerignore
index 285c57b..7c47342 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,3 +1,4 @@
 docker/rsync
+!docker/rsync/files
 docker/build
 docker/docker-compose.yml
diff --git a/docker/buildmaster/Dockerfile b/docker/buildmaster/Dockerfile
index 0a2e8c5..d3a6376 100644
--- a/docker/buildmaster/Dockerfile
+++ b/docker/buildmaster/Dockerfile
@@ -1,4 +1,4 @@
-FROM        debian:9
+FROM        debian:10
 MAINTAINER  OpenWrt Maintainers
 
 ARG         DEBIAN_FRONTEND=noninteractive
@@ -20,9 +20,15 @@ RUN apt-get update && \
 	pv \
 	gosu \
 	signify-openbsd \
+	python3-pip \
 	wget && \
     apt-get clean && \
-    localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
+    localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 && \
+    pip3 install \
+	"buildbot-www==2.0.1" \
+	"buildbot-waterfall-view==2.0.1" \
+	"buildbot-console-view==2.0.1" \
+	"buildbot-grid-view==2.0.1"
 
 ENV LANG=en_US.utf8
 
diff --git a/phase1/buildbot.tac b/phase1/buildbot.tac
index 16f0972..a2efaa8 100644
--- a/phase1/buildbot.tac
+++ b/phase1/buildbot.tac
@@ -1,36 +1,31 @@
-
 import os
 
 from twisted.application import service
 from buildbot.master import BuildMaster
 
-basedir = r'.'
+basedir = '.'
 rotateLength = 10000000
 maxRotatedFiles = 10
+configfile = 'master.cfg'
+
+# Default umask for server
+umask = None
 
 # if this is a relocatable tac file, get the directory containing the TAC
 if basedir == '.':
-    import os.path
+    import os
     basedir = os.path.abspath(os.path.dirname(__file__))
 
 # note: this line is matched against to check that this is a buildmaster
 # directory; do not edit it.
 application = service.Application('buildmaster')
+from twisted.python.logfile import LogFile
+from twisted.python.log import ILogObserver, FileLogObserver
+logfile = LogFile.fromFullPath(os.path.join(basedir, "twistd.log"), rotateLength=rotateLength,
+                                maxRotatedFiles=maxRotatedFiles)
+application.setComponent(ILogObserver, FileLogObserver(logfile).emit)
 
-try:
-  from twisted.python.logfile import LogFile
-  from twisted.python.log import ILogObserver, FileLogObserver
-  logfile = LogFile.fromFullPath(os.path.join(basedir, "twistd.log"), rotateLength=rotateLength,
-                                 maxRotatedFiles=maxRotatedFiles)
-  application.setComponent(ILogObserver, FileLogObserver(logfile).emit)
-except ImportError:
-  # probably not yet twisted 8.2.0 and beyond, can't set log yet
-  pass
-
-configfile = r'master.cfg'
-
-m = BuildMaster(basedir, configfile)
+m = BuildMaster(basedir, configfile, umask)
 m.setServiceParent(application)
 m.log_rotation.rotateLength = rotateLength
 m.log_rotation.maxRotatedFiles = maxRotatedFiles
-
diff --git a/phase1/master.cfg b/phase1/master.cfg
index 792f9b3..24262ad 100644
--- a/phase1/master.cfg
+++ b/phase1/master.cfg
@@ -5,14 +5,14 @@ import os
 import re
 import base64
 import subprocess
-import ConfigParser
+import configparser
 
 from buildbot import locks
 
 # This is a sample buildmaster config file. It must be installed as
 # 'master.cfg' in your buildmaster's base directory.
 
-ini = ConfigParser.ConfigParser()
+ini = configparser.ConfigParser()
 ini.read(os.getenv("BUILDMASTER_CONFIG", "./config.ini"))
 
 # This is the dictionary that the buildmaster pays attention to. We also use
@@ -38,17 +38,17 @@ c['buildbotURL'] = ini.get("phase1", "buildbot_url")
 
 ####### BUILDSLAVES
 
-# The 'slaves' list defines the set of recognized buildslaves. Each element is
-# a BuildSlave object, specifying a unique slave name and password.  The same
+# The 'workers' list defines the set of recognized buildslaves. Each element is
+# a Worker object, specifying a unique slave name and password.  The same
 # slave name and password must be configured on the slave.
-from buildbot.buildslave import BuildSlave
+from buildbot.worker import Worker
 
 slave_port = 9989
 
 if ini.has_option("phase1", "port"):
 	slave_port = ini.getint("phase1", "port")
 
-c['slaves'] = []
+c['workers'] = []
 NetLocks = dict()
 
 for section in ini.sections():
@@ -81,15 +81,15 @@ for section in ini.sections():
 				sl_props['shared_wd'] = shared_wd
 				if shared_wd and (max_builds != 1):
 					raise ValueError('max_builds must be 1 with shared workdir!')
-			c['slaves'].append(BuildSlave(name, password, max_builds = max_builds, properties = sl_props))
+			c['workers'].append(Worker(name, password, max_builds = max_builds, properties = sl_props))
 
-# 'slavePortnum' defines the TCP port to listen on for connections from slaves.
+# 'slavePortnum' defines the TCP port to listen on for connections from workers.
 # This must match the value configured into the buildslaves (with their
 # --master option)
-c['slavePortnum'] = slave_port
+c['protocols'] = {'pb': {'port': slave_port}}
 
 # coalesce builds
-c['mergeRequests'] = True
+c['collapseRequests'] = True
 
 # Reduce amount of backlog data
 c['buildHorizon'] = 30
@@ -184,7 +184,7 @@ while True:
 	line = findtargets.stdout.readline()
 	if not line:
 		break
-	ta = line.strip().split(' ')
+	ta = line.decode().strip().split(' ')
 	targets.append(ta[0])
 
 
@@ -220,7 +220,7 @@ c['schedulers'].append(ForceScheduler(
 ####### BUILDERS
 
 # The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
-# what steps, and which slaves can execute them.  Note that any particular build will
+# what steps, and which workers can execute them.  Note that any particular build will
 # only take place on one slave.
 
 from buildbot.process.factory import BuildFactory
@@ -313,7 +313,7 @@ def GetVersionPrefix(props):
 @properties.renderer
 def GetNumJobs(props):
 	if props.hasProperty("max_builds") and props.hasProperty("nproc"):
-		return str(int(props["nproc"]) / (props["max_builds"] + other_builds))
+		return str(int(int(props["nproc"]) / (props["max_builds"] + other_builds)))
 	else:
 		return "1"
 
@@ -402,7 +402,7 @@ def UsignSec2Pub(seckey, comment="untrusted comment: secret key"):
 
 c['builders'] = []
 
-dlLock = locks.SlaveLock("slave_dl")
+dlLock = locks.WorkerLock("slave_dl")
 
 checkBuiltin = re.sub('[\t\n ]+', ' ', """
 	checkBuiltin() {
@@ -459,8 +459,8 @@ class IfBuiltinShellCommand(ShellCommand):
 
 slaveNames = [ ]
 
-for slave in c['slaves']:
-	slaveNames.append(slave.slavename)
+for slave in c['workers']:
+	slaveNames.append(slave.workername)
 
 for target in targets:
 	ts = target.split('/')
@@ -487,8 +487,8 @@ for target in targets:
 	factory.addStep(FileDownload(
 		name = "dlfindbinpl",
 		mastersrc = scripts_dir + '/findbin.pl',
-		slavedest = "../findbin.pl",
-		mode = 0755))
+		workerdest = "../findbin.pl",
+		mode = 0o755))
 
 	factory.addStep(SetPropertyFromCommand(
 		name = "gcc",
@@ -528,8 +528,8 @@ for target in targets:
 			name = "dlexpiresh",
 			doStepIf = IsExpireRequested,
 			mastersrc = scripts_dir + '/expire.sh',
-			slavedest = "../expire.sh",
-			mode = 0755))
+			workerdest = "../expire.sh",
+			mode = 0o755))
 
 		factory.addStep(ShellCommand(
 			name = "expire",
@@ -544,14 +544,14 @@ for target in targets:
 	factory.addStep(FileDownload(
 		name = "dlcleanupsh",
 		mastersrc = scripts_dir + '/cleanup.sh',
-		slavedest = "../cleanup.sh",
-		mode = 0755,
+		workerdest = "../cleanup.sh",
+		mode = 0o755,
 		doStepIf = IsCleanupRequested))
 
 	factory.addStep(ShellCommand(
 		name = "cleanold",
 		description = "Cleaning previous builds",
-		command = ["./cleanup.sh", c['buildbotURL'], Interpolate("%(prop:slavename)s"), Interpolate("%(prop:buildername)s"), "full"],
+		command = ["./cleanup.sh", c['buildbotURL'], Interpolate("%(prop:workername)s"), Interpolate("%(prop:buildername)s"), "full"],
 		workdir = ".",
 		haltOnFailure = True,
 		doStepIf = IsCleanupRequested,
@@ -560,7 +560,7 @@ for target in targets:
 	factory.addStep(ShellCommand(
 		name = "cleanup",
 		description = "Cleaning work area",
-		command = ["./cleanup.sh", c['buildbotURL'], Interpolate("%(prop:slavename)s"), Interpolate("%(prop:buildername)s"), "single"],
+		command = ["./cleanup.sh", c['buildbotURL'], Interpolate("%(prop:workername)s"), Interpolate("%(prop:buildername)s"), "single"],
 		workdir = ".",
 		haltOnFailure = True,
 		doStepIf = IsCleanupRequested,
@@ -656,15 +656,15 @@ for target in targets:
 	factory.addStep(StringDownload(
 		name = "ccachecc",
 		s = '#!/bin/sh\nexec ${CCACHE} ${CCC} "$@"\n',
-		slavedest = "../ccache_cc.sh",
-		mode = 0755,
+		workerdest = "../ccache_cc.sh",
+		mode = 0o755,
 	))
 
 	factory.addStep(StringDownload(
 		name = "ccachecxx",
 		s = '#!/bin/sh\nexec ${CCACHE} ${CCXX} "$@"\n',
-		slavedest = "../ccache_cxx.sh",
-		mode = 0755,
+		workerdest = "../ccache_cxx.sh",
+		mode = 0o755,
 	))
 
 	# Git SSH
@@ -672,8 +672,8 @@ for target in targets:
 		factory.addStep(StringDownload(
 			name = "dlgitclonekey",
 			s = git_ssh_key,
-			slavedest = "../git-clone.key",
-			mode = 0600,
+			workerdest = "../git-clone.key",
+			mode = 0o600,
 		))
 
 		factory.addStep(ShellCommand(
@@ -715,8 +715,8 @@ for target in targets:
 		factory.addStep(StringDownload(
 			name = "dlconfigseed",
 			s = config_seed + '\n',
-			slavedest = ".config",
-			mode = 0644
+			workerdest = ".config",
+			mode = 0o644
 		))
 
 	# configure
@@ -762,22 +762,22 @@ for target in targets:
 		factory.addStep(StringDownload(
 			name = "dlkeybuildpub",
 			s = UsignSec2Pub(usign_key, usign_comment),
-			slavedest = "key-build.pub",
-			mode = 0600,
+			workerdest = "key-build.pub",
+			mode = 0o600,
 		))
 
 		factory.addStep(StringDownload(
 			name = "dlkeybuild",
 			s = "# fake private key",
-			slavedest = "key-build",
-			mode = 0600,
+			workerdest = "key-build",
+			mode = 0o600,
 		))
 
 		factory.addStep(StringDownload(
 			name = "dlkeybuilducert",
 			s = "# fake certificate",
-			slavedest = "key-build.ucert",
-			mode = 0600,
+			workerdest = "key-build.ucert",
+			mode = 0o600,
 		))
 
 	# prepare dl
@@ -976,7 +976,7 @@ for target in targets:
 		))
 
 		factory.addStep(FileUpload(
-			slavesrc = "sign.tar.gz",
+			workersrc = "sign.tar.gz",
 			masterdest = "%s/signing/%s.%s.tar.gz" %(work_dir, ts[0], ts[1]),
 			haltOnFailure = True
 		))
@@ -992,7 +992,7 @@ for target in targets:
 		factory.addStep(FileDownload(
 			name = "dlsigntargz",
 			mastersrc = "%s/signing/%s.%s.tar.gz" %(work_dir, ts[0], ts[1]),
-			slavedest = "sign.tar.gz",
+			workerdest = "sign.tar.gz",
 			haltOnFailure = True
 		))
 
@@ -1052,8 +1052,8 @@ for target in targets:
 	factory.addStep(FileDownload(
 		name = "dlsha2rsyncpl",
 		mastersrc = scripts_dir + '/sha2rsync.pl',
-		slavedest = "../sha2rsync.pl",
-		mode = 0755,
+		workerdest = "../sha2rsync.pl",
+		mode = 0o755,
 	))
 
 	factory.addStep(ShellCommand(
@@ -1066,8 +1066,8 @@ for target in targets:
 	factory.addStep(FileDownload(
 		name = "dlrsync.sh",
 		mastersrc = scripts_dir + '/rsync.sh',
-		slavedest = "../rsync.sh",
-		mode = 0755
+		workerdest = "../rsync.sh",
+		mode = 0o755
 	))
 
 	# upload new files and update existing ones
@@ -1118,7 +1118,7 @@ for target in targets:
 			name = "sourceupload",
 			description = "Uploading source archives",
 			command=["../rsync.sh", "--files-from=sourcelist", "--size-only", "--delay-updates"] + rsync_src_defopts +
-			         [Interpolate("--partial-dir=.~tmp~%(kw:target)s~%(kw:subtarget)s~%(prop:slavename)s", target=ts[0], subtarget=ts[1]), "-a", "dl/", "%s/" %(rsync_src_url)],
+			         [Interpolate("--partial-dir=.~tmp~%(kw:target)s~%(kw:subtarget)s~%(prop:workername)s", target=ts[0], subtarget=ts[1]), "-a", "dl/", "%s/" %(rsync_src_url)],
 			env={'RSYNC_PASSWORD': rsync_src_key},
 			haltOnFailure = True,
 			logEnviron = False,
@@ -1169,7 +1169,7 @@ for target in targets:
 
 	from buildbot.config import BuilderConfig
 
-	c['builders'].append(BuilderConfig(name=target, slavenames=slaveNames, factory=factory, nextBuild=GetNextBuild))
+	c['builders'].append(BuilderConfig(name=target, workernames=slaveNames, factory=factory, nextBuild=GetNextBuild))
 
 
 ####### STATUS TARGETS
@@ -1178,31 +1178,29 @@ for target in targets:
 # pushed to these targets. buildbot/status/*.py has a variety to choose from,
 # including web pages, email senders, and IRC bots.
 
-c['status'] = []
-
-from buildbot.status import html
-from buildbot.status.web import authz, auth
+from buildbot.plugins import util
 
 if ini.has_option("phase1", "status_bind"):
+	c['www'] = {
+		'port': ini.get("phase1", "status_bind"),
+		'plugins': {
+			'waterfall_view': True,
+			'console_view': True,
+			'grid_view': True
+		}
+	}
+
 	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("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',
-			pingBuilder = False,
-			stopBuild = 'auth',
-			stopAllBuilds = 'auth',
-			cancelPendingBuild = 'auth',
+		c['www']['auth'] = util.UserPasswordAuth([
+			(ini.get("phase1", "status_user"), ini.get("phase1", "status_password"))
+		])
+		c['www']['authz'] = util.Authz(
+			allowRules=[ util.AnyControlEndpointMatcher(role="admins") ],
+			roleMatchers=[ util.RolesFromUsername(roles=["admins"], usernames=[ini.get("phase1", "status_user")]) ]
 		)
-		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("phase1", "status_bind")))
 
 
-from buildbot.status import words
+from buildbot.plugins import reporters
 
 if ini.has_option("irc", "host") and ini.has_option("irc", "nickname") and ini.has_option("irc", "channel"):
 	irc_host = ini.get("irc", "host")
@@ -1217,16 +1215,14 @@ if ini.has_option("irc", "host") and ini.has_option("irc", "nickname") and ini.h
 	if ini.has_option("irc", "password"):
 		irc_pass = ini.get("irc", "password")
 
-	irc = words.IRC(irc_host, irc_nick, port = irc_port, password = irc_pass,
-			channels = [{ "channel": irc_chan }],
-			notify_events = {
-			  'exception': 1,
-			  'successToFailure': 1,
-			  'failureToSuccess': 1
-			}
+	irc = reporters.IRC(irc_host, irc_nick,
+		port = irc_port,
+		password = irc_pass,
+		channels = [ irc_chan ],
+		notify_events = [ 'exception', 'problem', 'recovery' ]
 	)
 
-	c['status'].append(irc)
+	c['services'].append(irc)
 
 ####### DB URL
 
@@ -1235,3 +1231,5 @@ c['db'] = {
 	# this at its default for all but the largest installations.
 	'db_url' : "sqlite:///state.sqlite",
 }
+
+c['buildbotNetUsageData'] = None
diff --git a/phase2/buildbot.tac b/phase2/buildbot.tac
index 16f0972..a2efaa8 100644
--- a/phase2/buildbot.tac
+++ b/phase2/buildbot.tac
@@ -1,36 +1,31 @@
-
 import os
 
 from twisted.application import service
 from buildbot.master import BuildMaster
 
-basedir = r'.'
+basedir = '.'
 rotateLength = 10000000
 maxRotatedFiles = 10
+configfile = 'master.cfg'
+
+# Default umask for server
+umask = None
 
 # if this is a relocatable tac file, get the directory containing the TAC
 if basedir == '.':
-    import os.path
+    import os
     basedir = os.path.abspath(os.path.dirname(__file__))
 
 # note: this line is matched against to check that this is a buildmaster
 # directory; do not edit it.
 application = service.Application('buildmaster')
+from twisted.python.logfile import LogFile
+from twisted.python.log import ILogObserver, FileLogObserver
+logfile = LogFile.fromFullPath(os.path.join(basedir, "twistd.log"), rotateLength=rotateLength,
+                                maxRotatedFiles=maxRotatedFiles)
+application.setComponent(ILogObserver, FileLogObserver(logfile).emit)
 
-try:
-  from twisted.python.logfile import LogFile
-  from twisted.python.log import ILogObserver, FileLogObserver
-  logfile = LogFile.fromFullPath(os.path.join(basedir, "twistd.log"), rotateLength=rotateLength,
-                                 maxRotatedFiles=maxRotatedFiles)
-  application.setComponent(ILogObserver, FileLogObserver(logfile).emit)
-except ImportError:
-  # probably not yet twisted 8.2.0 and beyond, can't set log yet
-  pass
-
-configfile = r'master.cfg'
-
-m = BuildMaster(basedir, configfile)
+m = BuildMaster(basedir, configfile, umask)
 m.setServiceParent(application)
 m.log_rotation.rotateLength = rotateLength
 m.log_rotation.maxRotatedFiles = maxRotatedFiles
-
diff --git a/phase2/master.cfg b/phase2/master.cfg
index da2bbd8..f5be23e 100644
--- a/phase2/master.cfg
+++ b/phase2/master.cfg
@@ -5,11 +5,11 @@ import os
 import re
 import base64
 import subprocess
-import ConfigParser
+import configparser
 
 from buildbot import locks
 
-ini = ConfigParser.ConfigParser()
+ini = configparser.ConfigParser()
 ini.read(os.getenv("BUILDMASTER_CONFIG", "./config.ini"))
 
 buildbot_url = ini.get("phase2", "buildbot_url")
@@ -23,10 +23,10 @@ c = BuildmasterConfig = {}
 
 ####### BUILDSLAVES
 
-# The 'slaves' list defines the set of recognized buildslaves. Each element is
-# a BuildSlave object, specifying a unique slave name and password.  The same
+# The 'workers' list defines the set of recognized buildslaves. Each element is
+# a Worker object, specifying a unique slave name and password.  The same
 # slave name and password must be configured on the slave.
-from buildbot.buildslave import BuildSlave
+from buildbot.worker import Worker
 
 slave_port = 9990
 persistent = False
@@ -55,7 +55,7 @@ if ini.has_option("general", "git_ssh_key"):
 else:
 	git_ssh = False
 
-c['slaves'] = []
+c['workers'] = []
 max_builds = dict()
 
 for section in ini.sections():
@@ -78,15 +78,15 @@ for section in ini.sections():
 				if sl_props['shared_wd'] and (max_builds != 1):
 					raise ValueError('max_builds must be 1 with shared workdir!')
 
-			c['slaves'].append(BuildSlave(name, password, max_builds = max_builds[name], properties = sl_props))
+			c['workers'].append(Worker(name, password, max_builds = max_builds[name], properties = sl_props))
 
-# 'slavePortnum' defines the TCP port to listen on for connections from slaves.
+# 'slavePortnum' defines the TCP port to listen on for connections from workers.
 # This must match the value configured into the buildslaves (with their
 # --master option)
-c['slavePortnum'] = slave_port
+c['protocols'] = {'pb': {'port': slave_port}}
 
 # coalesce builds
-c['mergeRequests'] = True
+c['collapseRequests'] = True
 
 # Reduce amount of backlog data
 c['buildHorizon'] = 30
@@ -152,7 +152,7 @@ while True:
 	line = findarches.stdout.readline()
 	if not line:
 		break
-	at = line.strip().split()
+	at = line.decode().strip().split()
 	arches.append(at)
 	archnames.append(at[0])
 
@@ -210,11 +210,10 @@ c['schedulers'].append(ForceScheduler(
 ####### BUILDERS
 
 # The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
-# what steps, and which slaves can execute them.  Note that any particular build will
+# what steps, and which workers can execute them.  Note that any particular build will
 # only take place on one slave.
 
 from buildbot.process.factory import BuildFactory
-from buildbot.steps.source import Git
 from buildbot.steps.shell import ShellCommand
 from buildbot.steps.shell import SetProperty
 from buildbot.steps.transfer import FileUpload
@@ -233,8 +232,8 @@ def GetDirectorySuffix(props):
 	return ""
 
 def GetNumJobs(props):
-	if props.hasProperty("slavename") and props.hasProperty("nproc"):
-		return ((int(props["nproc"]) / (max_builds[props["slavename"]] + other_builds)) + 1)
+	if props.hasProperty("workername") and props.hasProperty("nproc"):
+		return ((int(props["nproc"]) / (max_builds[props["workername"]] + other_builds)) + 1)
 	else:
 		return 1
 
@@ -261,12 +260,12 @@ def IsSharedWorkdir(step):
 
 c['builders'] = []
 
-dlLock = locks.SlaveLock("slave_dl")
+dlLock = locks.WorkerLock("slave_dl")
 
 slaveNames = [ ]
 
-for slave in c['slaves']:
-	slaveNames.append(slave.slavename)
+for slave in c['workers']:
+	slaveNames.append(slave.workername)
 
 for arch in arches:
 	ts = arch[1].split('/')
@@ -292,14 +291,14 @@ for arch in arches:
 	# prepare workspace
 	factory.addStep(FileDownload(
 		mastersrc = scripts_dir + '/cleanup.sh',
-		slavedest = "../cleanup.sh",
-		mode = 0755))
+		workerdest = "../cleanup.sh",
+		mode = 0o755))
 
 	if not persistent:
 		factory.addStep(ShellCommand(
 			name = "cleanold",
 			description = "Cleaning previous builds",
-			command = ["./cleanup.sh", buildbot_url, WithProperties("%(slavename)s"), WithProperties("%(buildername)s"), "full"],
+			command = ["./cleanup.sh", buildbot_url, WithProperties("%(workername)s"), WithProperties("%(buildername)s"), "full"],
 			workdir = ".",
 			haltOnFailure = True,
 			timeout = 2400))
@@ -307,7 +306,7 @@ for arch in arches:
 		factory.addStep(ShellCommand(
 			name = "cleanup",
 			description = "Cleaning work area",
-			command = ["./cleanup.sh", buildbot_url, WithProperties("%(slavename)s"), WithProperties("%(buildername)s"), "single"],
+			command = ["./cleanup.sh", buildbot_url, WithProperties("%(workername)s"), WithProperties("%(buildername)s"), "single"],
 			workdir = ".",
 			haltOnFailure = True,
 			timeout = 2400))
@@ -316,8 +315,8 @@ for arch in arches:
 	elif tree_expire > 0:
 		factory.addStep(FileDownload(
 			mastersrc = scripts_dir + '/expire.sh',
-			slavedest = "../expire.sh",
-			mode = 0755))
+			workerdest = "../expire.sh",
+			mode = 0o755))
 
 		factory.addStep(ShellCommand(
 			name = "expire",
@@ -362,8 +361,8 @@ for arch in arches:
 	factory.addStep(StringDownload(
 		name = "writeversionmk",
 		s = 'TOPDIR:=${CURDIR}\n\ninclude $(TOPDIR)/include/version.mk\n\nversion:\n\t at echo $(VERSION_NUMBER)\n',
-		slavedest = "sdk/getversion.mk",
-		mode = 0755))
+		workerdest = "sdk/getversion.mk",
+		mode = 0o755))
 
 	factory.addStep(SetProperty(
 		name = "getversion",
@@ -377,20 +376,20 @@ for arch in arches:
 		factory.addStep(StringDownload(
 			name = "dlkeybuildpub",
 			s = UsignSec2Pub(usign_key, usign_comment),
-			slavedest = "sdk/key-build.pub",
-			mode = 0600))
+			workerdest = "sdk/key-build.pub",
+			mode = 0o600))
 
 		factory.addStep(StringDownload(
 			name = "dlkeybuild",
 			s = "# fake private key",
-			slavedest = "sdk/key-build",
-			mode = 0600))
+			workerdest = "sdk/key-build",
+			mode = 0o600))
 
 		factory.addStep(StringDownload(
 			name = "dlkeybuilducert",
 			s = "# fake certificate",
-			slavedest = "sdk/key-build.ucert",
-			mode = 0600))
+			workerdest = "sdk/key-build.ucert",
+			mode = 0o600))
 
 	factory.addStep(ShellCommand(
 		name = "mkdldir",
@@ -406,8 +405,8 @@ for arch in arches:
 
 	factory.addStep(FileDownload(
 		mastersrc = scripts_dir + '/ccache.sh',
-		slavedest = 'sdk/ccache.sh',
-		mode = 0755))
+		workerdest = 'sdk/ccache.sh',
+		mode = 0o755))
 
 	factory.addStep(ShellCommand(
 		name = "prepccache",
@@ -420,8 +419,8 @@ for arch in arches:
 		factory.addStep(StringDownload(
 			name = "dlgitclonekey",
 			s = git_ssh_key,
-			slavedest = "../git-clone.key",
-			mode = 0600))
+			workerdest = "../git-clone.key",
+			mode = 0o600))
 
 		factory.addStep(ShellCommand(
 			name = "patchfeedsconf",
@@ -493,7 +492,7 @@ for arch in arches:
 		))
 
 		factory.addStep(FileUpload(
-			slavesrc = "sdk/sign.tar.gz",
+			workersrc = "sdk/sign.tar.gz",
 			masterdest = "%s/signing/%s.tar.gz" %(work_dir, arch[0]),
 			haltOnFailure = True
 		))
@@ -508,7 +507,7 @@ for arch in arches:
 
 		factory.addStep(FileDownload(
 			mastersrc = "%s/signing/%s.tar.gz" %(work_dir, arch[0]),
-			slavedest = "sdk/sign.tar.gz",
+			workerdest = "sdk/sign.tar.gz",
 			haltOnFailure = True
 		))
 
@@ -590,7 +589,7 @@ for arch in arches:
 			description = "Uploading source archives",
 			workdir = "build/sdk",
 			command = ["rsync", "--files-from=sourcelist", "-4", "--progress", "--checksum", "--delay-updates",
-			           WithProperties("--partial-dir=.~tmp~%s~%%(slavename)s" %(arch[0])), "-avz", "dl/", "%s/" %(rsync_src_url)],
+			           WithProperties("--partial-dir=.~tmp~%s~%%(workername)s" %(arch[0])), "-avz", "dl/", "%s/" %(rsync_src_url)],
 			env={'RSYNC_PASSWORD': rsync_src_key},
 			haltOnFailure = False,
 			logEnviron = False
@@ -607,7 +606,7 @@ for arch in arches:
 
 	from buildbot.config import BuilderConfig
 
-	c['builders'].append(BuilderConfig(name=arch[0], slavenames=slaveNames, factory=factory))
+	c['builders'].append(BuilderConfig(name=arch[0], workernames=slaveNames, factory=factory))
 
 
 ####### STATUS arches
@@ -616,28 +615,26 @@ for arch in arches:
 # pushed to these arches. buildbot/status/*.py has a variety to choose from,
 # including web pages, email senders, and IRC bots.
 
-c['status'] = []
-
-from buildbot.status import html
-from buildbot.status.web import authz, auth
+from buildbot.plugins import util
 
 if ini.has_option("phase2", "status_bind"):
+	c['www'] = {
+		'port': ini.get("phase2", "status_bind"),
+		'plugins': {
+			'waterfall_view': True,
+			'console_view': True,
+			'grid_view': True
+		}
+	}
+
 	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("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',
-			pingBuilder = False,
-			stopBuild = 'auth',
-			stopAllBuilds = 'auth',
-			cancelPendingBuild = 'auth',
+		c['www']['auth'] = util.UserPasswordAuth([
+			(ini.get("phase2", "status_user"), ini.get("phase2", "status_password"))
+		])
+		c['www']['authz'] = util.Authz(
+			allowRules=[ util.AnyControlEndpointMatcher(role="admins") ],
+			roleMatchers=[ util.RolesFromUsername(roles=["admins"], usernames=[ini.get("phase2", "status_user")]) ]
 		)
-		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("phase2", "status_bind")))
 
 ####### PROJECT IDENTITY
 
@@ -663,3 +660,5 @@ c['db'] = {
 	# this at its default for all but the largest installations.
 	'db_url' : "sqlite:///state.sqlite",
 }
+
+c['buildbotNetUsageData'] = None



More information about the lede-commits mailing list