Auto merge of #114206 - sethp:patch-1, r=Mark-Simulacrum

fix(ci): Ensure idempotence of user creation

Previously, re-running `run.sh` in the same container would fail at the useradd step, because the user already exists. Instead, change that step to "create if not exists" semantics to ease interactive debugging of CI failures.

Split out from https://github.com/rust-lang/rust/pull/111891 per request by `@jackh726`
This commit is contained in:
bors 2023-08-07 03:22:14 +00:00
commit 9fca8e7517

View File

@ -8,7 +8,7 @@ fi
if [ "$NO_CHANGE_USER" = "" ]; then
if [ "$LOCAL_USER_ID" != "" ]; then
useradd --shell /bin/bash -u $LOCAL_USER_ID -o -c "" -m user
id -u user &>/dev/null || useradd --shell /bin/bash -u $LOCAL_USER_ID -o -c "" -m user
export HOME=/home/user
unset LOCAL_USER_ID