Skip to content

Commit d7b91c3

Browse files
Add global safe.directory for CI
1 parent 6c7f301 commit d7b91c3

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

src/ci/docker/host-x86_64/armhf-gnu/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ RUN curl -O https://ci-mirrors.rust-lang.org/rustc/vexpress-v2p-ca15-tc1.dtb
7878
COPY scripts/sccache.sh /scripts/
7979
RUN sh /scripts/sccache.sh
8080

81+
COPY static/gitconfig /etc/gitconfig
82+
8183
ENV RUST_CONFIGURE_ARGS --qemu-armhf-rootfs=/tmp/rootfs
8284
ENV SCRIPT python3 ../x.py --stage 2 test --host='' --target arm-unknown-linux-gnueabihf
8385

src/ci/docker/host-x86_64/wasm32/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ ENV TARGETS=wasm32-unknown-emscripten
4848
# Use -O1 optimizations in the link step to reduce time spent optimizing.
4949
ENV EMCC_CFLAGS=-O1
5050

51+
COPY static/gitconfig /etc/gitconfig
52+
5153
# Emscripten installation is user-specific
5254
ENV NO_CHANGE_USER=1
5355

src/ci/docker/static/gitconfig

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[safe]
2+
directory = *

src/ci/run.sh

+10
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ if [ "$NO_CHANGE_USER" = "" ]; then
1111
useradd --shell /bin/bash -u $LOCAL_USER_ID -o -c "" -m user
1212
export HOME=/home/user
1313
unset LOCAL_USER_ID
14+
15+
# Ensure that runners are able to execute git commands in the worktree,
16+
# overriding the typical git protections. In our docker container we're running
17+
# as root, while the user owning the checkout is not root.
18+
# This is only necessary when we change the user, otherwise we should
19+
# already be running with the right user.
20+
#
21+
# For NO_CHANGE_USER done in the small number of Dockerfiles affected.
22+
echo -e '[safe]\n\tdirectory = *' > /home/user/gitconfig
23+
1424
exec su --preserve-environment -c "env PATH=$PATH \"$0\"" user
1525
fi
1626
fi

0 commit comments

Comments
 (0)