Docker/oci and thus gitlab-runner, default to a root user inside the namespace, even if its an unprivileged one. This can cause issues and let permission bugs sneak in, as we are functionally root when running the build. Switch the build jobs to run with our new "containeruser" so we avoid much of it. Our user is still in the wheel/sudo group but that's fine as long we don't elevate the privileges unintentionally. Noticeably for the time being, we will need to chown the CI_PROJECT_DIR checkout as the gitlab runner might try to reuse pre-existing and cached volumes of the project checkout. Additionally we need to change the ccache path, so we will avoid the existing cache owned by "root". Close https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2433 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8763>
23 lines
766 B
Bash
23 lines
766 B
Bash
#! /bin/bash
|
|
|
|
set -eux
|
|
|
|
dnf update && dnf install -y sudo shadow-utils
|
|
bash ./ci/scripts/create-ci-identifier.sh
|
|
bash ./ci/scripts/create-container-user.sh
|
|
|
|
sudo -u containeruser bash ./ci/docker/fedora/install-deps.sh
|
|
sudo -u containeruser bash ./ci/scripts/install-rust.sh
|
|
|
|
# Configure git for various usage
|
|
sudo -u containeruser git config --global user.email "gstreamer@gstreamer.net"
|
|
sudo -u containeruser git config --global user.name "Gstbuild Runner"
|
|
# /tmp/clone is where ci-templates cbuild clones the checkout
|
|
sudo -u containeruser git config --global --add safe.directory /tmp/clone
|
|
|
|
sudo -u containeruser bash ./ci/scripts/create-subprojects-cache.sh
|
|
|
|
# leftover caches
|
|
sudo rm -rf /root/
|
|
sudo rm -rf /home/containeruser/.cache /home/containeruser/.npm
|