From 31264c17c9d50b224b90c40fbfe9481d1c1f2dd8 Mon Sep 17 00:00:00 2001 From: Bo Lorentsen Date: Sat, 24 Oct 2026 18:35:05 +0200 Subject: [PATCH] Separate runner dir from persistent build dir; guard against self-sync --- .gitea/workflows/build.yaml | 40 +++++++++++++++++++++++-------------- .zed/settings.json | 5 +++++ 2 files changed, 30 insertions(+), 15 deletions(-) create mode 100644 .zed/settings.json diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 5f67843..4f9abbf 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -2,11 +2,13 @@ name: Build RPi image # Yocto (kas) build of rpilinux-image for raspberrypi4-64. # -# Runs on the dedicated host runner (label "yocto:host", Ryzen 9 box). +# Runs on the dedicated host runner (label "yocto:host", Ryzen 9 box "ada"). # Everything persists in $YOCTO_HOME: extern/ (layer clones) + build/ (sstate) # survive between runs -> incremental builds after the first. -# $YOCTO_HOME defaults to $HOME/yocto-ci; override it via runner.envs -# (runner.envs.YOCTO_HOME=/data/yocto-ci) to put it on the big disk. +# $YOCTO_HOME comes from the runner config (runner.envs.YOCTO_HOME = +# /home/bl/yocto-build, on the 1.8T disk); falls back to $HOME/yocto-build. +# +# First build takes hours (poky fetch + full image) -> runner.timeout >= 8h. # # First build takes hours (poky fetch + full image) -> runner.timeout >= 8h. @@ -35,7 +37,7 @@ jobs: echo "=== runner environment ===" uname -a [ -r /etc/os-release ] && . /etc/os-release && echo "$PRETTY_NAME" - echo "HOME=$HOME nproc=$(nproc)" + echo "HOME=$HOME workspace=$GITEA_WORKSPACE nproc=$(nproc)" df -h "$HOME" | tail -1 free -h 2>/dev/null | sed -n 2p || true command -v docker >/dev/null && docker info --format 'docker: {{.ServerVersion}}' 2>/dev/null || echo "no docker daemon" @@ -58,29 +60,37 @@ jobs: - name: Set up kas (persistent venv) run: | set -e - export YOCTO_HOME="${YOCTO_HOME:-$HOME/yocto-ci}" + export YOCTO_HOME="${YOCTO_HOME:-$HOME/yocto-build}" mkdir -p "$YOCTO_HOME" [ -d "$YOCTO_HOME/venv" ] || python3 -m venv "$YOCTO_HOME/venv" "$YOCTO_HOME/venv/bin/pip" -q install -U kas "$YOCTO_HOME/venv/bin/kas" --version - - name: Sync to persistent project dir and build + - name: Sync to persistent build dir and build run: | set -euo pipefail - export YOCTO_HOME="${YOCTO_HOME:-$HOME/yocto-ci}" - # Persistent project dir: keeps extern/ (layer clones) and build/ - # (sstate + tmp) between runs -> incremental builds after the first. - rsync -a --delete \ - --exclude .git --exclude extern --exclude build \ - ./ "$YOCTO_HOME/yocto_rpi/" - cd "$YOCTO_HOME/yocto_rpi" - git config --global --add safe.directory "$YOCTO_HOME/yocto_rpi" || true + export YOCTO_HOME="${YOCTO_HOME:-$HOME/yocto-build}" + SRC="$(pwd)" + DST="$YOCTO_HOME/yocto_rpi" + # Safety: builtin:checkout cleans ignored files (build/, extern/), + # so the build tree must NOT be the ephemeral workspace. + if [ "$SRC" = "$DST" ]; then + echo "::error::workspace == persistent dir ($SRC); keep the runner WorkingDirectory outside YOCTO_HOME" + exit 1 + fi + echo "syncing $SRC -> $DST" + mkdir -p "$DST" + # .git is copied (kas expects a git repo); extern/ and build/ exist + # only in DST and are excluded, so --delete cannot touch them. + rsync -a --delete --exclude /build/ --exclude /extern/ ./ "$DST/" + cd "$DST" + git config --global --add safe.directory "$DST" || true "$YOCTO_HOME/venv/bin/kas" build - name: Collect images run: | set -euo pipefail - export YOCTO_HOME="${YOCTO_HOME:-$HOME/yocto-ci}" + export YOCTO_HOME="${YOCTO_HOME:-$HOME/yocto-build}" cd "$YOCTO_HOME/yocto_rpi" IMG_DIR="build/*/tmp/deploy/images/raspberrypi4-64" ls -lh $IMG_DIR diff --git a/.zed/settings.json b/.zed/settings.json new file mode 100644 index 0000000..79860b3 --- /dev/null +++ b/.zed/settings.json @@ -0,0 +1,5 @@ +// Folder-specific settings +// +// For a full list of overridable settings, and general information on folder-specific settings, +// see the documentation: https://zed.dev/docs/configuring-zed#settings-files +{}