commit 5a52f0cee1922f43da5a3368704dfe53b436986e
parent 77d514e4db271565cc0fe6afae7b35d73c6faa44
Author: Florian Dold <dold@taler.net>
Date: Mon, 7 Sep 2026 17:33:05 +0200
buildbot: cache the full TypeScript repository checkout
Retain Git history and fetch release tags between TypeScript builds.
Clean build outputs with the fresh checkout method, replacing existing
shallow checkouts once with a full clone.
Diffstat:
1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/buildbot/master.cfg b/buildbot/master.cfg
@@ -1075,6 +1075,7 @@ for repo in container_repos:
# Factory-wide variables
REPO_NAME = repo.rsplit('/', 1)[1]
REPO_URL = "git://" + repo + ".git"
+ CACHE_CHECKOUT = REPO_NAME == "taler-typescript-core"
CONTAINER_WORKDIR = f"/home/container-worker/workspace/{REPO_NAME}"
CI_JOBS_PATH = f"{CONTAINER_WORKDIR}/contrib/ci/jobs"
@@ -1082,18 +1083,32 @@ for repo in container_repos:
container_factory = util.BuildFactory()
container_factory.workdir = CONTAINER_WORKDIR
- # Setup workspace
+ # Containers can leave files owned by root. Make them writable before cleanup.
+ workspace_command = (
+ f"if test -d {CONTAINER_WORKDIR}; then "
+ f"podman run --log-driver=none --rm --volume {CONTAINER_WORKDIR}:/workdir "
+ "docker.io/library/debian:bookworm-slim chmod -R 777 /workdir; fi"
+ )
+ if CACHE_CHECKOUT:
+ # Replace the previous shallow clone once, then retain the full checkout.
+ workspace_command += (
+ f" && if test -f {CONTAINER_WORKDIR}/.git/shallow; then "
+ f"rm -rf {CONTAINER_WORKDIR}; fi"
+ )
+ else:
+ workspace_command += f" && rm -rf {CONTAINER_WORKDIR}"
+ workspace_command += f" && mkdir -p {CONTAINER_WORKDIR}"
+
container_factory.addStep(ShellCommand(
name="workspace",
descriptionDone="Workspace directory check",
- command=f"test -d {CONTAINER_WORKDIR} && podman run --log-driver=none --rm --volume {CONTAINER_WORKDIR}:/workdir docker.io/library/debian:bookworm-slim chmod -R 777 /workdir ; rm -rf {CONTAINER_WORKDIR} && mkdir -p {CONTAINER_WORKDIR} || mkdir -p {CONTAINER_WORKDIR}",
+ command=workspace_command,
haltOnFailure=True,
))
- # Ensure repo is cloned or clean.
- # Git() will clone repo if it doesn't exist.
- # Method clobber removes directory and makes a fresh clone.
- # Shallow set to "True" defaults to a depth of 1.
+ # "fresh" cleans build outputs but retains Git history between builds.
+ # TypeScript build versions require full history and release tags.
+ # Other container builders use a new depth-1 clone on every build.
# Will checkout value of "branch" property from job properties.
# https://docs.buildbot.net/latest/manual/configuration/steps/source_git.html
container_factory.addStep(Git(
@@ -1101,8 +1116,9 @@ for repo in container_repos:
repourl=REPO_URL,
branch=util.Interpolate('%(src::branch)s'),
mode='full',
- method='clobber',
- shallow=True,
+ method='fresh' if CACHE_CHECKOUT else 'clobber',
+ shallow=not CACHE_CHECKOUT,
+ tags=CACHE_CHECKOUT,
submodules=True,
haltOnFailure=True,
))