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 <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31281>
This commit is contained in:
Daniel Stone 2024-08-28 18:54:34 +01:00 committed by Marge Bot
parent 3e7c9aad8a
commit d741a6766e
7 changed files with 34 additions and 3 deletions

View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
. .gitlab-ci/container/debian/test-gl.sh
. .gitlab-ci/container/strip-rootfs.sh

View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
. .gitlab-ci/container/debian/test-vk.sh
. .gitlab-ci/container/strip-rootfs.sh

View file

@ -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

View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
. .gitlab-ci/container/debian/test-gl.sh
. .gitlab-ci/container/strip-rootfs.sh

View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
. .gitlab-ci/container/debian/test-vk.sh
. .gitlab-ci/container/strip-rootfs.sh

View file

@ -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 <<EOF
#!/bin/bash
if [ "\${1:-}" != "clean" ]; then
echo "Couldn't run '\$0 \$*', because apt has been cleaned from this container."
echo ""
echo "After .gitlab-ci/container/strip-rootfs.sh has run, you cannot install"
echo "new packages."
echo ""
echo "Sorry."
exit 1
fi
EOF
chmod +x /usr/bin/apt-get
ln -s /usr/bin/apt-get /usr/bin/apt

View file

@ -27,9 +27,9 @@ variables:
DEBIAN_ARM64_TEST_IMAGE_VK_PATH: "debian/arm64_test-vk"
DEBIAN_X86_64_TEST_ANDROID_IMAGE_PATH: "debian/x86_64_test-android"
DEBIAN_TEST_ANDROID_TAG: "20240926-git-hash"
DEBIAN_TEST_GL_TAG: "20240927-vvl"
DEBIAN_TEST_VK_TAG: "20241001-vkcts"
DEBIAN_TEST_ANDROID_TAG: "20241006-strip"
DEBIAN_TEST_GL_TAG: "20241006-strip"
DEBIAN_TEST_VK_TAG: "20241006-strip"
KERNEL_ROOTFS_TAG: "20241001-vkcts"
DEBIAN_PYUTILS_IMAGE: "debian/x86_64_pyutils"