From 4d83b63fde3255c9c990c190b770237b2b616762 Mon Sep 17 00:00:00 2001 From: WANG Xuerui Date: Sat, 21 Sep 2024 12:31:13 +0800 Subject: [PATCH] ci: use a proper PID1 for the build containers Maybe the weird `dotnet build-server shutdown` hangs are due to the entrypoint being made `tail -f /dev/null` by the GHA runner in the "initialize container" step. ``` $ ls -alf /tmp total 0 drwxrwxrwt 1 root root 538 Sep 21 04:31 ./ drwxr-xr-x 1 root root 42 Sep 21 04:22 ../ drwxrwxrwx 1 root root 6 Sep 21 04:28 .dotnet/ drwx------ 1 root root 54 Sep 21 04:31 19e80c20-032d-44d5-9fdb-d7f6c997a39d/ srwxr-xr-x 1 root root 0 Sep 21 04:31 IysC7CuZMEweYuTSXW+sBF5o_ulkrefjRwckP1n6_+E= drwx------ 1 root root 0 Sep 21 04:30 MSBuildTemproot/ drwx------ 1 root root 8 Sep 21 04:28 NuGetScratchroot/ drwx------ 1 root root 0 Sep 21 04:31 a8ef3f16-dbf3-4bf8-a554-6d1c52b1dcbf/ drwxr-xr-x 1 root root 0 Sep 21 04:21 ccache/ prwx------ 1 root root 0 Sep 21 04:31 clr-debug-pipe-1029-15867104-in| prwx------ 1 root root 0 Sep 21 04:31 clr-debug-pipe-1029-15867104-out| srw------- 1 root root 0 Sep 21 04:31 dotnet-diagnostic-1029-15867104-socket= drwxr-xr-x 1 root root 0 Sep 21 04:21 out/ drwxr-xr-x 1 root root 196 Sep 21 04:22 rootfs/ $ ls -alFR /tmp/.dotnet /tmp/.dotnet: total 0 drwxrwxrwx 1 root root 6 Sep 21 04:28 ./ drwxrwxrwt 1 root root 538 Sep 21 04:31 ../ drwxrwxrwx 1 root root 12 Sep 21 04:31 shm/ /tmp/.dotnet/shm: total 0 drwxrwxrwx 1 root root 12 Sep 21 04:31 ./ drwxrwxrwx 1 root root 6 Sep 21 04:28 ../ drwxrwxrwx 1 root root 100 Sep 21 04:31 global/ /tmp/.dotnet/shm/global: total 4 drwxrwxrwx 1 root root 100 Sep 21 04:31 ./ drwxrwxrwx 1 root root 12 Sep 21 04:31 ../ -rw-rw-rw- 1 root root 4096 Sep 21 04:31 IysC7CuZMEweYuTSXW+sBF5o_ulkrefjRwckP1n6_+E.server $ ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 04:20 ? 00:00:00 tail -f /dev/null root 233 0 0 04:21 ? 00:00:00 sh -e /__w/_temp/e7c93450-3b0d-4fea-b329-767d664d2422.sh root 239 233 0 04:21 ? 00:00:00 /bin/bash ./build.sh root 1029 1 19 04:31 ? 00:00:04 /vmr/.dotnet/dotnet exec /vmr/.dotnet/sdk/9.0.100-preview.7.24407.12/Roslyn/bincore/VBCSCompiler.dll -pipename:IysC7CuZMEweYuTSXW+sBF5o_ulkrefjRwckP1n6_+E root 6624 239 0 04:31 ? 00:00:00 ps -ef ``` *Maybe* having a proper PID1 will help the build server correctly terminate itself... Signed-off-by: WANG Xuerui --- .github/workflows/build.yml | 1 + build-locally.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a21ddae..a86a808 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,6 +16,7 @@ jobs: run_id: ${{ github.run_id }} container: image: ghcr.io/loongson-community/dotnet-unofficial-build-builder:20240918T124748Z + options: --init # to take care of msbuild & roslyn build server processes credentials: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} diff --git a/build-locally.sh b/build-locally.sh index 75bfe35..f6b2418 100755 --- a/build-locally.sh +++ b/build-locally.sh @@ -36,6 +36,7 @@ main() { -e OUT_DIR=/tmp/out -e ROOTFS_DIR=/tmp/rootfs + --init -u b -w /work "$BUILDER_IMAGE_TAG"