diff mbox series

[yocto-autobuilder2] Fix overriding of the yocto-autobuilder-helper parameters

Message ID 20250113-fix-autobuilder-dep-v1-1-52de04667ee5@bootlin.com
State New
Headers show
Series [yocto-autobuilder2] Fix overriding of the yocto-autobuilder-helper parameters | expand

Commit Message

Antonin Godard Jan. 13, 2025, 8:36 a.m. UTC
Like the docs build in commit afa838d962b7 ("docs build: make it
possible to override repo settings") we can make the
yocto-autobuilder-helper part of the repo dependencies in config.py, and
then pass branch and uri information to the builders using util.Property
and util.Interpolate. This allows overriding the
yocto-autobuilder-helper URI/branch when starting a build manually.

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 builders.py   |  8 ++++----
 config.py     |  6 +++++-
 schedulers.py | 20 ++++++++++++++++++--
 3 files changed, 27 insertions(+), 7 deletions(-)


---
base-commit: 8f6709cf0fad448ea87d80b50cd2ae375e5066b2
change-id: 20250110-fix-autobuilder-dep-8ae03830e17d

Best regards,
diff mbox series

Patch

diff --git a/builders.py b/builders.py
index 4f2bf00e5387d910f23579028a410e250fccf588..81308211155f7ec71cfb559e40e68f8742a698c7 100644
--- a/builders.py
+++ b/builders.py
@@ -104,8 +104,8 @@  def create_builder_factory():
         haltOnFailure=True,
         name="Clobber build dir"))
     f.addStep(steps.Git(
-        repourl=config.repos["yocto-autobuilder-helper"][0],
-        branch=config.repos["yocto-autobuilder-helper"][1],
+        repourl=util.Interpolate("%(prop:repo_yocto-autobuilder-helper)s"),
+        branch=util.Property('branch_yocto-autobuilder-helper'),
         workdir=util.Interpolate("%(prop:builddir)s/yocto-autobuilder-helper"),
         mode='incremental',
         haltOnFailure=True,
@@ -260,8 +260,8 @@  def create_parent_builder_factory(buildername, waitname):
                     name="Clobber build dir"))
     # check out the source
     factory.addStep(steps.Git(
-        repourl=config.repos["yocto-autobuilder-helper"][0],
-        branch=config.repos["yocto-autobuilder-helper"][1],
+        repourl=util.Interpolate("%(prop:repo_yocto-autobuilder-helper)s"),
+        branch=util.Property('branch_yocto-autobuilder-helper'),
         workdir=util.Interpolate("%(prop:builddir)s/yocto-autobuilder-helper"),
         mode='incremental',
         haltOnFailure=True,
diff --git a/config.py b/config.py
index 8e2797aaeed7e2c688983d3d1f3c4b1895d393b8..062eafd290c06a49cdb8a6d3e358bea748e15877 100644
--- a/config.py
+++ b/config.py
@@ -27,7 +27,7 @@  buildertorepos = {
     "checkuri": ["poky"],
     "check-layer": ["poky", "meta-mingw", "meta-gplv2"],
     "check-layer-nightly": ["poky", "meta-agl", "meta-arm", "meta-aws", "meta-intel", "meta-openembedded", "meta-virtualization", "meta-ti", "meta-security", "meta-clang", "meta-exein"],
-    "docs": ["yocto-autobuilder-helper", "yocto-docs", "bitbake"],
+    "docs": ["yocto-docs", "bitbake"],
     "reproducible-meta-oe": ["poky", "meta-openembedded"],
     "patchtest": ["poky", "meta-patchtest", "meta-openembedded"],
     "meta-oe-mirror":  ["poky", "meta-openembedded"],
@@ -38,6 +38,10 @@  buildertorepos = {
     "default": ["poky"]
 }
 
+# Add yocto-autobuilder-helper as a default repo dependency
+for builder in buildertorepos:
+    buildertorepos[builder] = ["yocto-autobuilder-helper"] + buildertorepos[builder]
+
 # Repositories used that the scripts need to know about and should be buildbot
 # user customisable
 repos = {
diff --git a/schedulers.py b/schedulers.py
index e4760ed8bf1d02f4edca9af87725cf116630a14b..18ec236391c0f63a49e6b0503b3612eba24c4225 100644
--- a/schedulers.py
+++ b/schedulers.py
@@ -399,7 +399,15 @@  for builder in config.subbuilders:
     schedulers.append(sched.ForceScheduler(
         name=builder,
         builderNames=[builder],
-        codebases=[util.CodebaseParameter(codebase='', label="yocto-autobuilder-helper:", project=None)],
+        # Note: we pass FixedParameters here to hide these in the form, since
+        # entries to override the URL and branch are already created thanks to
+        # props_for_builder() below.
+        codebases=[util.CodebaseParameter(codebase='',
+                                          branch=util.FixedParameter(name="branch", default=""),
+                                          revision=util.FixedParameter(name="revision", default=""),
+                                          repository=util.FixedParameter(name="repository", default=""),
+                                          label="yocto-autobuilder-helper:",
+                                          project=None)],
         reason=util.StringParameter(
                 name="reason",
                 label="""Reason (please note the reason for triggering the
@@ -457,7 +465,15 @@  def parent_scheduler(target):
     name=target,
     builderNames=[target],
     buttonName="Start " + target + " Build",
-    codebases = [util.CodebaseParameter(codebase='', label="yocto-autobuilder-helper:", project=None)],
+    # Note: we pass FixedParameters here to hide these in the form, since
+    # entries to override the URL and branch are already created thanks to
+    # props_for_builder() below.
+    codebases = [util.CodebaseParameter(codebase='',
+                                        branch=util.FixedParameter(name="branch", default=""),
+                                        revision=util.FixedParameter(name="revision", default=""),
+                                        repository=util.FixedParameter(name="repository", default=""),
+                                        label="yocto-autobuilder-helper:",
+                                        project=None)],
     reason=util.StringParameter(
         name="reason",
         label="""Reason (please note the reason for triggering the build and