From 69c24f6d04c7ca140c4d6db2a2d3d8edf9e79c6e Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 5 Aug 2026 09:03:22 +0800 Subject: [PATCH] ci: take product name explicitly instead of deriving it from checkout dir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every consuming product's CI checks out into a directory literally named `src` (see e.g. breadpad's checkout step), so basename(repo_root) resolved to "src" for every product in real CI runs — not the actual product name, which only looked right in local testing because that happened to run from a directory actually named after the product. In production this meant every product sharing the runner would have collided on the same image tag (bread-ci:src) and the same cargo-target cache volume, silently mixing compiled artifacts across unrelated repos. Caught before a second product (breadmon/breadclip/breadshot) started using this and made the collision real. --- ci/build.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/ci/build.sh b/ci/build.sh index 4e3269b..6e6b8b7 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -5,8 +5,14 @@ # from ci/Containerfile, then runs the given cargo command inside it # against a product repo checkout. # -# Usage: ci/build.sh -# e.g. ci/build.sh /path/to/breadpad cargo build --release --locked +# Usage: ci/build.sh +# e.g. ci/build.sh breadpad /path/to/breadpad cargo build --release --locked +# +# is used verbatim as the image tag and cache-volume name — +# it must be passed explicitly rather than derived from 's +# basename, because every product's CI checks out into a directory literally +# named `src`, which would otherwise collide across every product sharing +# this runner (same image tag, same cargo-target cache volume). # # If /ci/deps.txt exists (one pacman package per line, # '#' comments and blank lines ignored), those packages are installed on @@ -17,16 +23,16 @@ # per-product. Both persist in named docker volumes across runs. set -euo pipefail -if [ $# -lt 2 ]; then - echo "usage: build.sh " >&2 +if [ $# -lt 3 ]; then + echo "usage: build.sh " >&2 exit 1 fi -REPO_ROOT="$(cd "$1" && pwd)" -shift +PRODUCT="$1" +REPO_ROOT="$(cd "$2" && pwd)" +shift 2 CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -PRODUCT="$(basename "$REPO_ROOT")" EXTRA_PKGS="" if [ -f "${REPO_ROOT}/ci/deps.txt" ]; then