From 6be651b79e5fdfa510e701eabb9fb936ebef1c7a Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 12 Nov 2026 21:51:47 +0000 Subject: [PATCH] fix(image): resolve owner.sh from the script directory, not the cwd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit build.sh called scripts/meta/resolve/repository/owner.sh by a path relative to the working directory. Whenever OWNER, GITHUB_REPOSITORY_OWNER or GITHUB_REPOSITORY reached it, a build started outside the repository root exited 127. TestBuildCachePrune runs build.sh from a temporary directory, so CI (which carries an owner variable) failed four tests while a local run without one passed. The call now goes through _build_script_dir. The test sets GITHUB_REPOSITORY_OWNER, so it takes this path on every machine. 🎯 Fix: 95 % 💥 Break: 1 % 💸 Cost: – ⏱️ Time: – 🛡️ Security: ~100 % 🏆 Score: 94 🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 % Co-Authored-By: Claude Opus 5.5 --- scripts/image/build.sh | 2 +- tests/unit/python/scripts/image/test_build_cache_prune.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/image/build.sh b/scripts/image/build.sh index 07baa18e82..e7032eece8 100755 --- a/scripts/image/build.sh +++ b/scripts/image/build.sh @@ -157,7 +157,7 @@ if [[ -n "${REPO_PREFIX}" ]]; then fi if [[ -n "${OWNER}" || -n "${GITHUB_REPOSITORY_OWNER:-}" || -n "${GITHUB_REPOSITORY:-}" ]]; then - OWNER="$(OWNER="${OWNER}" GITHUB_REPOSITORY_OWNER="${GITHUB_REPOSITORY_OWNER:-}" GITHUB_REPOSITORY="${GITHUB_REPOSITORY:-}" scripts/meta/resolve/repository/owner.sh)" + OWNER="$(OWNER="${OWNER}" GITHUB_REPOSITORY_OWNER="${GITHUB_REPOSITORY_OWNER:-}" GITHUB_REPOSITORY="${GITHUB_REPOSITORY:-}" "${_build_script_dir}/../meta/resolve/repository/owner.sh")" fi if [[ -z "${TARGET}" ]]; then diff --git a/tests/unit/python/scripts/image/test_build_cache_prune.py b/tests/unit/python/scripts/image/test_build_cache_prune.py index f79efa3e60..1866dfbedb 100644 --- a/tests/unit/python/scripts/image/test_build_cache_prune.py +++ b/tests/unit/python/scripts/image/test_build_cache_prune.py @@ -57,9 +57,10 @@ def _build(prune_help: str, cap: str) -> tuple[int, list[str], str]: "INFINITO_PYTHON_INSTALL_SCRIPT": "python.sh", "INFINITO_DOCKER_CLI_INSTALL_SCRIPT": "docker-cli.sh", "INFINITO_BUILD_CACHE_MAX_SIZE": cap, + "GITHUB_REPOSITORY_OWNER": "probe-owner", } ) - for key in ("GITHUB_REPOSITORY", "GITHUB_REPOSITORY_OWNER", "OWNER"): + for key in ("GITHUB_REPOSITORY", "OWNER"): env.pop(key, None) done = subprocess.run( ["bash", str(SCRIPT), "--tag", "probe/debian:dev-1"],