[CI] make container be able to re-attached (#7848)

When re-starting the container, it will fail in entrypoint.sh which
will exit when adding an existing group or user
This commit is contained in:
Bobby Wang 2022-04-30 10:00:35 +08:00 committed by GitHub
parent 288c52596c
commit 1b103e1f5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,9 +20,9 @@ else
fi
if [[ -n $CI_BUILD_UID ]] && [[ -n $CI_BUILD_GID ]]; then
groupadd -o -g "${CI_BUILD_GID}" "${CI_BUILD_GROUP}"
groupadd -o -g "${CI_BUILD_GID}" "${CI_BUILD_GROUP}" || true
useradd -o -m -g "${CI_BUILD_GID}" -u "${CI_BUILD_UID}" \
"${CI_BUILD_USER}"
"${CI_BUILD_USER}" || true
export HOME="/home/${CI_BUILD_USER}"
shopt -s dotglob
cp -r /root/* "$HOME/"