]> git.lizzy.rs Git - rust.git/commitdiff
Add global safe.directory for CI
authorMark Rousskov <mark.simulacrum@gmail.com>
Wed, 10 Aug 2022 11:16:25 +0000 (07:16 -0400)
committerMark Rousskov <mark.simulacrum@gmail.com>
Sat, 20 Aug 2022 13:47:59 +0000 (09:47 -0400)
src/ci/docker/host-x86_64/armhf-gnu/Dockerfile
src/ci/docker/host-x86_64/wasm32/Dockerfile
src/ci/docker/static/gitconfig [new file with mode: 0644]
src/ci/run.sh

index e2dbc7cfd7c640890eede20363468a4414d987f6..69f88e4952019e6dc96fa5d2afd371895d296679 100644 (file)
@@ -78,6 +78,8 @@ RUN curl -O https://ci-mirrors.rust-lang.org/rustc/vexpress-v2p-ca15-tc1.dtb
 COPY scripts/sccache.sh /scripts/
 RUN sh /scripts/sccache.sh
 
+COPY static/gitconfig /etc/gitconfig
+
 ENV RUST_CONFIGURE_ARGS --qemu-armhf-rootfs=/tmp/rootfs
 ENV SCRIPT python3 ../x.py --stage 2 test --host='' --target arm-unknown-linux-gnueabihf
 
index 878c4e341589d8e52598f71d4440e3023febb825..9e37c2822e8bd58d5d166c7c2bc60832f0221a76 100644 (file)
@@ -48,6 +48,8 @@ ENV TARGETS=wasm32-unknown-emscripten
 # Use -O1 optimizations in the link step to reduce time spent optimizing.
 ENV EMCC_CFLAGS=-O1
 
+COPY static/gitconfig /etc/gitconfig
+
 # Emscripten installation is user-specific
 ENV NO_CHANGE_USER=1
 
diff --git a/src/ci/docker/static/gitconfig b/src/ci/docker/static/gitconfig
new file mode 100644 (file)
index 0000000..6bad35f
--- /dev/null
@@ -0,0 +1,2 @@
+[safe]
+directory = *
index 091ccf58e2b81cdebd075dac134fda52357e88c7..9a247fb60a8ee0535c20ecc4d5ab0f4e135c8ab4 100755 (executable)
@@ -11,6 +11,16 @@ if [ "$NO_CHANGE_USER" = "" ]; then
     useradd --shell /bin/bash -u $LOCAL_USER_ID -o -c "" -m user
     export HOME=/home/user
     unset LOCAL_USER_ID
+
+    # Ensure that runners are able to execute git commands in the worktree,
+    # overriding the typical git protections. In our docker container we're running
+    # as root, while the user owning the checkout is not root.
+    # This is only necessary when we change the user, otherwise we should
+    # already be running with the right user.
+    #
+    # For NO_CHANGE_USER done in the small number of Dockerfiles affected.
+    echo -e '[safe]\n\tdirectory = *' > /home/user/gitconfig
+
     exec su --preserve-environment -c "env PATH=$PATH \"$0\"" user
   fi
 fi