ci: fix setup of custom path for GitLab CI

Part of "install-dependencies.sh" is to install some binaries required for tests into a custom directory that gets added to the PATH. This directory is located at "$HOME/path" and thus depends on the current user that the script executes as. This creates problems for GitLab CI, which installs dependencies as the root user, but runs tests as a separate, unprivileged user. As their respective home directories are different, we will end up using two different custom path directories. Consequently, the unprivileged user will not be able to find the binaries that were set up as root user. Fix this issue by allowing CI to override the custom path, which allows GitLab to set up a constant value that isn't derived from "$HOME". Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Apr 12, 2024 at 06:44 UTC 2c5c7639e59a73f1428fa6fb5dff647234046f59
2 files changed +3 -1
.gitlab-ci.yml
+2
@@ -9,6 +9,8 @@ workflow:
9
10 test:linux:
11 image: $image
12 + variables:
13 + CUSTOM_PATH: "/custom"
14 before_script:
15 - ./ci/install-docker-dependencies.sh
16 script:
ci/lib.sh
+1 -1
@@ -350,7 +350,7 @@ macos-*)
350 ;;
351 esac
352
353 -CUSTOM_PATH="$HOME/path"
353 +CUSTOM_PATH="${CUSTOM_PATH:-$HOME/path}"
354 export PATH="$CUSTOM_PATH:$PATH"
355
356 case "$jobname" in