Skip to contentSkip to conversation

builders: Allow partial matching of helper branches

PATCH New Richard Purdie 1 participant 1 message Oct 7, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 builders: Allow partial matching of helper branches

Helper branches with names like contrib/kirkstone-nut don't work with worker restrictions currently. Try and fix this.

---
 builders.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
builders.py +9 -6
index b4685ec5..580ae264 100644
@@ -158,12 +158,15 @@ def nextWorker(bldr, workers, buildrequest):
     if '' in buildrequest.sources:
         # Has to be a better way to do this
         branch = buildrequest.sources[''].branch
-    if branch and branch in config.workers_prev_releases and "bringup" not in bldr.name:
-        possible_workers = []
-        for w in workers:
-            if w.worker.workername.startswith(config.workers_prev_releases[branch]):
-                possible_workers.append(w)
-        log.msg("nextWorker: Limiting %s to workers %s for %s" % (str(bldr), str(possible_workers), branch))
+    if branch and "bringup" not in bldr.name:
+        for branchname in config.workers_prev_releases:
+            if branch in branchname:
+                possible_workers = []
+                for w in workers:
+                    if w.worker.workername.startswith(config.workers_prev_releases[branchname]):
+                        possible_workers.append(w)
+                log.msg("nextWorker: Limiting %s to workers %s for %s" % (str(bldr), str(possible_workers), branchname))
+                break
 
     if forced_worker == "*":
         return random.choice(possible_workers) if possible_workers else None