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>
This commit is contained in:
Patrick Steinhardt
2024-04-12 06:44:27 +02:00
committed by Junio C Hamano
parent d1ef3d3b1d
commit 2c5c7639e5
2 changed files with 3 additions and 1 deletions

View File

@ -9,6 +9,8 @@ workflow:
test:linux:
image: $image
variables:
CUSTOM_PATH: "/custom"
before_script:
- ./ci/install-docker-dependencies.sh
script:

View File

@ -350,7 +350,7 @@ macos-*)
;;
esac
CUSTOM_PATH="$HOME/path"
CUSTOM_PATH="${CUSTOM_PATH:-$HOME/path}"
export PATH="$CUSTOM_PATH:$PATH"
case "$jobname" in