From 13ff12c811fda692da9e45305528f963b0f71d82 Mon Sep 17 00:00:00 2001 From: Devan Carpenter Date: Mon, 12 Jun 2023 23:09:50 -0400 Subject: buildbot: generate steps from project's CI dir This should allow any repo added to the "container builder" to generate steps by adding a subdir to "/ci/jobs/" containing shell scripts. Each script will create a new step in the factory. --- buildbot/master.cfg | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/buildbot/master.cfg b/buildbot/master.cfg index b2f980a..253afb3 100644 --- a/buildbot/master.cfg +++ b/buildbot/master.cfg @@ -24,6 +24,8 @@ # @author ng0 # @author Christian Grothoff # @author Devan Carpenter +import os +import pathlib import re from buildbot.steps.source.git import Git @@ -1198,7 +1200,7 @@ EMAIL_ALERTS.append("packaging-ubuntu-builder") ############################################# ## # These factories uses the standard podman worker. -WORKERS.append(worker.Worker("container-worker", "container-pass")) +WORKERS.append(Worker("container-worker", "container-pass")) # # container_repos = ["backoffice", "wallet-core", "bank", "exchange", @@ -1240,9 +1242,22 @@ for reponame in container_repos: )) # Run container step with default commands - container_run_step("Build docs", - container_factory, CONTAINER_WORKDIR, reponame, - "ci/jobs/docs.sh") + CI_JOBS_PATH = f"{CONTAINER_WORKDIR}/ci/jobs" + if os.path.exists(CI_JOBS_PATH): + for parentDir, dirNames, fileNames in os.walk(CI_JOBS_PATH): + dirNames.sort() + fileNames.sort() + for filename in fileNames: + if filename.endswith('.sh'): + basedir = pathlib.PurePath(parentDir) + container_run_step(basedir, + container_factory, + CONTAINER_WORKDIR, reponame, + f"ci/jobs/{basedir}/{filename}") + else: + print("No jobs found") + else: + print("Cannot find jobs directory") BUILDERS.append(util.BuilderConfig( name=f"{reponame}-builder", -- cgit v1.2.3