[buildbot] phase1: do not leak targets between branches

LEDE Commits lede-commits at lists.infradead.org
Mon Jul 24 05:16:32 PDT 2023


ynezz pushed a commit to buildbot.git, annotated tag v8:
https://git.openwrt.org/3bbbc02a7f8b677026fbc856a336225e2630c050

commit 3bbbc02a7f8b677026fbc856a336225e2630c050
Author: Petr Štetiar <ynezz at true.cz>
AuthorDate: Sun Jun 18 07:26:17 2023 +0200

    phase1: do not leak targets between branches
    
    Robert noticed, that after rename of `ipq807x` target in main branch to
    `qualcommax/ipq807x` subtarget, that buildbot is trying to build this
    new `qualcommax/ipq807x` subtarget on `openwrt-23.05` branch as well.
    
    Thibaut later explained, that this is by design, his initial idea was to
    find exhaustive list of all targets and let the `checkarch` step do the
    final triaging.
    
    I find this approach confusing, because if the subtarget is not present
    in that branch, we shouldn't have builder for it configured as well.
    Furthermore wasting roughly 5 minutes of precious buildworker time to
    checkout all feeds and then just find out, that we're not going to use
    those seems suboptimal as well.
    
    So lets fix it by using builders for targets as present in respective
    branches.
    
    Fixes: #14
    Reported-by: Robert Marko <robimarko at gmail.com>
    Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
 phase1/master.cfg | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/phase1/master.cfg b/phase1/master.cfg
index 799a40b..c4bccea 100644
--- a/phase1/master.cfg
+++ b/phase1/master.cfg
@@ -288,7 +288,7 @@ c["prioritizeBuilders"] = prioritizeBuilders
 ####### CHANGESOURCES
 
 # find targets
-targets = set()
+targets = dict()
 
 
 def populateTargets():
@@ -323,12 +323,13 @@ def populateTargets():
             cwd=sourcegit,
         )
 
+        targets[branch] = set()
         while True:
             line = findtargets.stdout.readline()
             if not line:
                 break
             ta = line.decode().strip().split(" ")
-            targets.add(ta[0])
+            targets[branch].add(ta[0])
 
         subprocess.call(["rm", "-rf", sourcegit])
 
@@ -521,7 +522,7 @@ c["schedulers"].append(
                 name="target",
                 label="Build target",
                 default="all",
-                choices=["all"] + list(targets),
+                choices=["all"] + [t for b in branchNames for t in targets[b]],
             ),
             TagChoiceParameter(name="tag", label="Build tag", default=""),
         ],
@@ -735,7 +736,7 @@ c["builders"].append(
 
 
 # NB the phase1 build factory assumes workers are single-build only
-for target in targets:
+def prepareFactory(target):
     ts = target.split("/")
 
     factory = BuildFactory()
@@ -1743,13 +1744,17 @@ for target in targets:
         )
     )
 
-    for brname in branchNames:
+    return factory
+
+
+for brname in branchNames:
+    for target in targets[brname]:
         bldrname = brname + "_" + target
         c["builders"].append(
             BuilderConfig(
                 name=bldrname,
                 workernames=workerNames,
-                factory=factory,
+                factory=prepareFactory(target),
                 tags=[
                     brname,
                 ],




More information about the lede-commits mailing list