Merge fix/ci-explicit-product-name: avoid CI image/cache collisions across products

This commit is contained in:
Breadway 2026-08-05 09:03:37 +08:00
commit 620c5a1317

View file

@ -5,8 +5,14 @@
# from ci/Containerfile, then runs the given cargo command inside it # from ci/Containerfile, then runs the given cargo command inside it
# against a product repo checkout. # against a product repo checkout.
# #
# Usage: ci/build.sh <product-repo-root> <cargo-command...> # Usage: ci/build.sh <product-name> <product-repo-root> <cargo-command...>
# e.g. ci/build.sh /path/to/breadpad cargo build --release --locked # e.g. ci/build.sh breadpad /path/to/breadpad cargo build --release --locked
#
# <product-name> is used verbatim as the image tag and cache-volume name —
# it must be passed explicitly rather than derived from <product-repo-root>'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 <product-repo-root>/ci/deps.txt exists (one pacman package per line, # If <product-repo-root>/ci/deps.txt exists (one pacman package per line,
# '#' comments and blank lines ignored), those packages are installed on # '#' comments and blank lines ignored), those packages are installed on
@ -17,16 +23,16 @@
# per-product. Both persist in named docker volumes across runs. # per-product. Both persist in named docker volumes across runs.
set -euo pipefail set -euo pipefail
if [ $# -lt 2 ]; then if [ $# -lt 3 ]; then
echo "usage: build.sh <product-repo-root> <cargo-command...>" >&2 echo "usage: build.sh <product-name> <product-repo-root> <cargo-command...>" >&2
exit 1 exit 1
fi fi
REPO_ROOT="$(cd "$1" && pwd)" PRODUCT="$1"
shift REPO_ROOT="$(cd "$2" && pwd)"
shift 2
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PRODUCT="$(basename "$REPO_ROOT")"
EXTRA_PKGS="" EXTRA_PKGS=""
if [ -f "${REPO_ROOT}/ci/deps.txt" ]; then if [ -f "${REPO_ROOT}/ci/deps.txt" ]; then