Commit 6d211c2d authored by Lukas Werner's avatar Lukas Werner
Browse files

Fixed usage of $WORK in root scripts

parent ed368aee
......@@ -5,11 +5,13 @@ shopt -s inherit_errexit
: "${CUSTOM_ENV_AUTH_USER:?"AUTH_USER CI/CD variable has not been set."}"
: "${CUSTOM_ENV_CI_CONCURRENT_PROJECT_ID:?"CI_CONCURRENT_PROJECT_ID CI/CD variable has not been set."}"
AUTH_USER_WORK=$(runuser "$AUTH_USER" --command "echo \$WORK")
cat << EOS
{
"builds_dir": "$WORK/gitlab-runner/builds/$CUSTOM_ENV_CI_CONCURRENT_PROJECT_ID",
"cache_dir": "$WORK/gitlab-runner/cache",
"builds_dir": "$AUTH_USER_WORK/gitlab-runner/builds/$CUSTOM_ENV_CI_CONCURRENT_PROJECT_ID",
"cache_dir": "$AUTH_USER_WORK/gitlab-runner/cache",
"builds_dir_is_shared": false,
"driver": {
"name": "Testserver Cx"
......
......@@ -30,6 +30,7 @@ function error {
AUTH_USER=$CUSTOM_ENV_AUTH_USER
AUTH_USER_HOME=$(getent passwd "$AUTH_USER" | awk -F ":" '{print $6}')
AUTH_USER_SHELL=$(getent passwd "$AUTH_USER" | awk -F ":" '{print $7}')
AUTH_USER_WORK=$(runuser "$AUTH_USER" --command "echo \$WORK")
## Check if the user exists and the validity of its ID
id -u "$AUTH_USER" >/dev/null 2>&1 || error "User $AUTH_USER does not exist"
......@@ -51,7 +52,7 @@ exit 1
chown -R "$AUTH_USER" "$TMPDIR"
BASE_DIR=$WORK/gitlab-runner/builds/${CUSTOM_ENV_CI_CONCURRENT_PROJECT_ID:?}/${CUSTOM_ENV_CI_PROJECT_NAMESPACE:?}/${CUSTOM_ENV_CI_PROJECT_NAME:?}
BASE_DIR=$AUTH_USER_WORK/gitlab-runner/builds/${CUSTOM_ENV_CI_CONCURRENT_PROJECT_ID:?}/${CUSTOM_ENV_CI_PROJECT_NAMESPACE:?}/${CUSTOM_ENV_CI_PROJECT_NAME:?}
runuser "$AUTH_USER" --command "mkdir -p $BASE_DIR"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment