Skip to content

Commit

Permalink
fix(ci): Ensure idempotence of user creation
Browse files Browse the repository at this point in the history
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 rust-lang#111891 per request by @jackh726
  • Loading branch information
sethp authored Jul 29, 2023
1 parent f9f674f commit 912dacb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 $LOCAL_USER_ID &>/dev/null || useradd --shell /bin/bash -u $LOCAL_USER_ID -o -c "" -m user
export HOME=/home/user
unset LOCAL_USER_ID

Expand Down

0 comments on commit 912dacb

Please sign in to comment.