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 <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2024-10-07 22:27:24 +01:00
parent 64cbb9b0ef
commit 48686d22b9

View File

@ -158,12 +158,15 @@ def nextWorker(bldr, workers, buildrequest):
if '' in buildrequest.sources: if '' in buildrequest.sources:
# Has to be a better way to do this # Has to be a better way to do this
branch = buildrequest.sources[''].branch branch = buildrequest.sources[''].branch
if branch and branch in config.workers_prev_releases and "bringup" not in bldr.name: if branch and "bringup" not in bldr.name:
possible_workers = [] for branchname in config.workers_prev_releases:
for w in workers: if branch in branchname:
if w.worker.workername.startswith(config.workers_prev_releases[branch]): possible_workers = []
possible_workers.append(w) for w in workers:
log.msg("nextWorker: Limiting %s to workers %s for %s" % (str(bldr), str(possible_workers), branch)) 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 == "*": if forced_worker == "*":
return random.choice(possible_workers) if possible_workers else None return random.choice(possible_workers) if possible_workers else None