phase1: allow restricting builders to tag builds only
authorThibaut VARÈNE <hacks@slashdirt.org>
Thu, 27 Oct 2022 12:56:21 +0000 (14:56 +0200)
committerPetr Štetiar <ynezz@true.cz>
Mon, 15 May 2023 15:36:01 +0000 (17:36 +0200)
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
phase1/config.ini.example
phase1/master.cfg

index 3a1e34e188ba78d5edf596a225081a8c7b524a09..5ae45fa1d1aab93df2feb4b6a5e400d2eed1aa92 100644 (file)
@@ -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
index 53d20986a3b69b9c8c7b5b09abf6f055ab83691b..21da1a2e35eb24f4957b60ff6ade07498fe668ba 100644 (file)
@@ -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