Sébastien Heurtemattechanged title from EF pipeline migration: ci job eddie-zephir failed failed due to to EF pipeline migration: ci job eddie-zephir failed failed due to permission denied
changed title from EF pipeline migration: ci job eddie-zephir failed failed due to to EF pipeline migration: ci job eddie-zephir failed failed due to permission denied
If this is not executing inside the docker executor, this will not work. If you have a requirement to use unprivileged user inside the container then the pipeline will not work.
The duplication of that is an obvious reason not to go down that route. I'm a bit confused here actually. What is the issue we have here? Why isn't the container process allowed to change files in its root?
Because it's in /etc and you need to be root for that.
Anyway, the include pipeline after that try to install packages which will not be possible due to our internal policy:
OK, so this is about running the process in the container as root mapped to root outside of the container. Is the EF foundation using a rootless podman setup for running containers on the workers? These details are the actual policy that I was looking for. Even so, these aspects are orthogonal. The root user in a container doesn't need to be mapped to the root user outside the container. In other words, I can run a rootless container where the user in the container will be root and be able to change the exact files that make the scope of this issue. Here is an example:
$ id -u1000$ podman run -ti ubuntu:22.04 bash[...]# id -u0# echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/force-unsafe-io# apt updateGet:1 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB][...]Fetched 23.4 MB in 2s (13.2 MB/s)Reading package lists... DoneBuilding dependency tree... DoneReading state information... DoneAll packages are up to date.# apt install git[...]done.
And this should make a lot of sense because at the end of the day we ran a process under a non-root user, that creates files under its home directory with the ownership permissions associated with the same user. So you would expect that the process would have full access to those files. The trick is that there is a user map in place thanks to user namespaces:
# cat /proc/self/uid_map 0 1000 1 1 100000 65536
You can easily check this if you run a simple rootless container which does:
You will find the upper filesystem in podman inspect and using that path, the file that was created. Here is an example:
andrei@hostname:~/.local/share/containers/storage/overlay/6eede37221069735aaaa21a125e4b7791761ae73c707728e592d7249ef322b50/diff$ ls -al etc/dpkg/dpkg.cfg.d/total 12drwxr-xr-x 2 andrei andrei 4096 Oct 11 17:03 .drwxr-xr-x 3 andrei andrei 4096 Oct 11 17:03 ..-rw-r--r-- 1 andrei andrei 16 Oct 11 17:03 force-unsafe-ioandrei@hostname:~/.local/share/containers/storage/overlay/6eede37221069735aaaa21a125e4b7791761ae73c707728e592d7249ef322b50/diff$ cat etc/dpkg/dpkg.cfg.d/force-unsafe-ioforce-unsafe-io
This is what makes the problem here orthogonal and makes me not agree with the general "no-root" umbrella policy unless you understand how subordinate UIDs work. It is not OKD to run as root in a container, it is OKD to avoid running as root mapped to the host's root user.
Regarding sysota#25 (comment 1024781). That is not really the same solution/problem (even though similar because even apt just creates. modifies and removes files). I agree that these packages are easier to maintain as part of the container image - hence agreeing there. Here we are also talking about extra root configuration in the container which makes this different.
@heurtemattes I'm happy to accept contributions to the pipeline I've created, so that it uses a docker container. Ideally the container would pre-install the SDK and all the packages.
Maybe we should discuss about provided this project under EF gitlab with dedicated runner. I had problems with gitlab and their new policies around gitlab shared runner minutes consumption.
That why you'll see buildkit configuration in gitlab-ci.yml.