How to run Xvfb as Gitlab service without sharing environement variables?
I have successfully executed some graphical tests trough Maven+JUnit in a docker container using network_mode=host, having Xvfb headless X11 server and defining DISPLAY=:1 environement variable.
But using network_mode at host, make my CI/CD jobs less isolated, especially some tests doing some port binding and when different jobs instance of a same pipeline execute such tests concurrently we have failures.
Then I change my strategy to embed Xvfb in a Gitlab service with Docker Hub Docker image.
With this image a X11 headless server is listening on :99 by default.
Then I must specify DISPLAY=xvfb:99 environment variable in my build container to access this Xvfb server:
- name: metal3d/xvfb
But with this job definition, I get following error from service container Xvfb:
Listening on :xvfb:99
Bad display name: xvfb:99
I understand, by reading The Docker executor | GitLab, that with “Legacy container links” environement variables are shared between service and build containers.
Then I enable FF_NETWORK_PER_BUILD feature flag in my config.toml but I get always this error.
My workaround is to add “export DISPLAY=xvfb:99” instruction in script part but I would like to find a way to not have variable defined in my gitlab-ci.yml exported in my services containers.
Someone does have an idea how to make my declared “DISPLAY=xvfb:99” environement variable available only for my build container?
Git revision: 5316d4ac
Git branch: 14-6-stable
GO version: go1.13.8