From 48686d22b940c46ba70e66fcaeda2d97df7957a0 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 7 Oct 2024 22:27:24 +0100 Subject: [PATCH] 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. Signed-off-by: Richard Purdie --- builders.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/builders.py b/builders.py index b4685ec..580ae26 100644 --- a/builders.py +++ b/builders.py @@ -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