[buildbot] phase1: allow restricting builders to tag builds only

LEDE Commits lede-commits at lists.infradead.org
Mon May 15 08:39:46 PDT 2023


ynezz pushed a commit to buildbot.git, branch master:
https://git.openwrt.org/16939fc2275c8d6ba446a3cba2e9c4629f74df9f

commit 16939fc2275c8d6ba446a3cba2e9c4629f74df9f
Author: Thibaut VARÈNE <hacks at slashdirt.org>
AuthorDate: Thu Oct 27 14:56:21 2022 +0200

    phase1: allow restricting builders to tag builds only
    
    Signed-off-by: Thibaut VARÈNE <hacks at slashdirt.org>
---
 phase1/config.ini.example |  7 +++++++
 phase1/master.cfg         | 15 +++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/phase1/config.ini.example b/phase1/config.ini.example
index 3a1e34e..5ae45fa 100644
--- a/phase1/config.ini.example
+++ b/phase1/config.ini.example
@@ -61,3 +61,10 @@ password = example
 phase = 1
 name = example-worker-2
 password = example2
+# for workers which share a common pipe, ul/dl resource-access locks can be defined.
+# if the identifier is the same for both ul/dl, then all ul/dl operations will be serialized between workers having the same id.
+# if the identifier differs for ul and dl, then dl operations will be serialized independently of ul operations.
+ul_lock = host1
+dl_lock = host1
+# tag_only workers will only build forced tag buildrequests (i.e. release builds)
+tag_only = yes
diff --git a/phase1/master.cfg b/phase1/master.cfg
index 53d2098..21da1a2 100644
--- a/phase1/master.cfg
+++ b/phase1/master.cfg
@@ -135,12 +135,13 @@ def ini_parse_workers(section):
 	name = section.get("name")
 	password = section.get("password")
 	phase = section.getint("phase")
+	tagonly = section.getboolean("tag_only")
 
 	if not name or not password or not phase == 1:
 		log.msg("invalid worker configuration ignored: {}".format(repr(section)))
 		return
 
-	sl_props = { 'dl_lock':None, 'ul_lock':None }
+	sl_props = { 'dl_lock':None, 'ul_lock':None, 'tag_only':tagonly }
 	if "dl_lock" in section:
 		lockname = section.get("dl_lock")
 		sl_props['dl_lock'] = lockname
@@ -595,6 +596,16 @@ def UsignSec2Pub(props):
 		base64.b64encode(seckey[0:2] + seckey[32:40] + seckey[72:]))
 
 
+def canStartBuild(builder, wfb, request):
+	""" filter out non tag requests for tag_only workers. """
+	wtagonly = wfb.worker.properties.getProperty('tag_only')
+	tag = request.properties.getProperty('tag')
+
+	if wtagonly and not tag:
+		return False
+
+	return True
+
 c['builders'] = []
 
 workerNames = [ ]
@@ -1241,7 +1252,7 @@ for target in targets:
 
 	for brname in branchNames:
 		bldrname = brname + "_" + target
-		c['builders'].append(BuilderConfig(name=bldrname, workernames=workerNames, factory=factory, nextBuild=GetNextBuild))
+		c['builders'].append(BuilderConfig(name=bldrname, workernames=workerNames, factory=factory, nextBuild=GetNextBuild, canStartBuild=canStartBuild))
 
 
 ####### STATUS TARGETS




More information about the lede-commits mailing list