Add support for Overlay Volume Mounts when Podman is used with Docker Executor
This change adds support for mounting directories using the overlay file system. It introduces a small change to the parser to support the :O
flag. This is useful for scenarios like speeding up container builds with minimal configuration.
As far as I know, Docker doesn’t support this option, but I think this is fine without additional checks.
Closes #31095 (closed), #29304 (closed).
Testing
- Build the
gitlab-runner
binary from this branch - Configure a runner using the Podman executor with an overlay volume mount, e.g.,
volumes = ["/opt/overlay-dir:/opt/overlay-dir:O"]
- Create some sample file to the host machine at
/opt/overlay-dir/file
. E.g.mkdir -p /opt/overlay-dir && echo "hello from host" > /opt/overlay-dir/file
Use the following sample .gitlab-ci.yml
:
image: docker.io/fedora:latest
stages:
- test-overlay
test_podman_overlay:
stage: test-overlay
tags: ["overlay-test"]
script:
- cat /opt/overlay-dir/file
- echo "hello from container" >> /opt/overlay-dir/file
- cat /opt/overlay-dir/file
And observe that the setup actually works:
$ cat /opt/overlay-dir/file
hello from host
$ echo "hello from container" >> /opt/overlay-dir/file
$ cat /opt/overlay-dir/file
hello from host
hello from container
Successful sample pipeline: https://gitlab.com/napuu/runner-testing-project/-/jobs/9840010719. And sample using runner from the current main where this obviously doesn't work: https://gitlab.com/napuu/runner-testing-project/-/jobs/9840010390
Edited by Napuu