From d741a6766e0c0342701bcafd82ba1996caa4302f Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 28 Aug 2024 18:54:34 +0100 Subject: [PATCH] ci/{b2c,swrast,layered}: Strip unnecessary things from runtime containers Bring it up to parity with the LAVA and bare-metal containers by stripping things we don't need at runtime. There is a lot of stuff we don't need in container images we only use to execute tests, including but not limited to the system Mesa which can only cause problems. Call the same strip-rootfs we already run for LAVA to make sure that this doesn't happen, as well as slimming down the container image. Signed-off-by: Daniel Stone Part-of: --- .gitlab-ci/container/debian/arm64_test-gl.sh | 2 ++ .gitlab-ci/container/debian/arm64_test-vk.sh | 2 ++ .../container/debian/x86_64_test-android.sh | 2 ++ .gitlab-ci/container/debian/x86_64_test-gl.sh | 2 ++ .gitlab-ci/container/debian/x86_64_test-vk.sh | 2 ++ .gitlab-ci/container/strip-rootfs.sh | 21 +++++++++++++++++++ .gitlab-ci/image-tags.yml | 6 +++--- 7 files changed, 34 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci/container/debian/arm64_test-gl.sh b/.gitlab-ci/container/debian/arm64_test-gl.sh index ad650371a26..9c596e245d6 100644 --- a/.gitlab-ci/container/debian/arm64_test-gl.sh +++ b/.gitlab-ci/container/debian/arm64_test-gl.sh @@ -1,3 +1,5 @@ #!/usr/bin/env bash . .gitlab-ci/container/debian/test-gl.sh + +. .gitlab-ci/container/strip-rootfs.sh diff --git a/.gitlab-ci/container/debian/arm64_test-vk.sh b/.gitlab-ci/container/debian/arm64_test-vk.sh index 58b04fd5268..70e28c56905 100644 --- a/.gitlab-ci/container/debian/arm64_test-vk.sh +++ b/.gitlab-ci/container/debian/arm64_test-vk.sh @@ -1,3 +1,5 @@ #!/usr/bin/env bash . .gitlab-ci/container/debian/test-vk.sh + +. .gitlab-ci/container/strip-rootfs.sh diff --git a/.gitlab-ci/container/debian/x86_64_test-android.sh b/.gitlab-ci/container/debian/x86_64_test-android.sh index 262c771ddbb..e0f5d0b56dd 100644 --- a/.gitlab-ci/container/debian/x86_64_test-android.sh +++ b/.gitlab-ci/container/debian/x86_64_test-android.sh @@ -108,3 +108,5 @@ rm -rf "/${ndk:?}" apt-get purge -y "${EPHEMERAL[@]}" . .gitlab-ci/container/container_post_build.sh + +. .gitlab-ci/container/strip-rootfs.sh diff --git a/.gitlab-ci/container/debian/x86_64_test-gl.sh b/.gitlab-ci/container/debian/x86_64_test-gl.sh index ad650371a26..9c596e245d6 100644 --- a/.gitlab-ci/container/debian/x86_64_test-gl.sh +++ b/.gitlab-ci/container/debian/x86_64_test-gl.sh @@ -1,3 +1,5 @@ #!/usr/bin/env bash . .gitlab-ci/container/debian/test-gl.sh + +. .gitlab-ci/container/strip-rootfs.sh diff --git a/.gitlab-ci/container/debian/x86_64_test-vk.sh b/.gitlab-ci/container/debian/x86_64_test-vk.sh index 58b04fd5268..70e28c56905 100644 --- a/.gitlab-ci/container/debian/x86_64_test-vk.sh +++ b/.gitlab-ci/container/debian/x86_64_test-vk.sh @@ -1,3 +1,5 @@ #!/usr/bin/env bash . .gitlab-ci/container/debian/test-vk.sh + +. .gitlab-ci/container/strip-rootfs.sh diff --git a/.gitlab-ci/container/strip-rootfs.sh b/.gitlab-ci/container/strip-rootfs.sh index cb6bec9d857..c88fcab5856 100644 --- a/.gitlab-ci/container/strip-rootfs.sh +++ b/.gitlab-ci/container/strip-rootfs.sh @@ -131,3 +131,24 @@ files=( for files in "${files[@]}"; do find /usr /etc -name "$files" -prune -exec rm -r {} \; done + +# We purge apt and dpkg to save on space, which is great for runtime and +# bandwidth use etc, but less great for cbuild which wants to run apt-get clean +# when we're done. Install a stub which works for that and is apologetic for +# anyone else. +cat >/usr/bin/apt-get <