summary refs log tree commit diff
path: root/src/ci
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-08-07 03:22:14 +0000
committerbors <bors@rust-lang.org>2023-08-07 03:22:14 +0000
commit9fca8e7517fd714685de8e580d8e0e08073c8e16 (patch)
tree21b92673a0fe03d2aaf204073f9ef2a9f08cecc4 /src/ci
parent2aae331706fee2a901766a0f0c008b263b077242 (diff)
parentfff66a954c7664d8263a00f3ca5f021dc0ca5716 (diff)
downloadrust-9fca8e7517fd714685de8e580d8e0e08073c8e16.tar.gz
rust-9fca8e7517fd714685de8e580d8e0e08073c8e16.zip
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`
Diffstat (limited to 'src/ci')
-rwxr-xr-xsrc/ci/run.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ci/run.sh b/src/ci/run.sh
index 1ff17ddb539..63239cdc6f2 100755
--- a/src/ci/run.sh
+++ b/src/ci/run.sh
@@ -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