1bf215546Sopenharmony_ciDocker CI
2bf215546Sopenharmony_ci=========
3bf215546Sopenharmony_ci
4bf215546Sopenharmony_ciFor llvmpipe and swrast CI, we run tests in a container containing
5bf215546Sopenharmony_ciVK-GL-CTS, on the shared GitLab runners provided by `freedesktop
6bf215546Sopenharmony_ci<http://freedesktop.org>`_
7bf215546Sopenharmony_ci
8bf215546Sopenharmony_ciSoftware architecture
9bf215546Sopenharmony_ci---------------------
10bf215546Sopenharmony_ci
11bf215546Sopenharmony_ciThe Docker containers are rebuilt using the shell scripts under
12bf215546Sopenharmony_ci.gitlab-ci/container/ when the FDO\_DISTRIBUTION\_TAG changes in
13bf215546Sopenharmony_ci.gitlab-ci.yml. The resulting images are around 1 GB, and are
14bf215546Sopenharmony_ciexpected to change approximately weekly (though an individual
15bf215546Sopenharmony_cideveloper working on them may produce many more images while trying to
16bf215546Sopenharmony_cicome up with a working MR!).
17bf215546Sopenharmony_ci
18bf215546Sopenharmony_cigitlab-runner is a client that polls gitlab.freedesktop.org for
19bf215546Sopenharmony_ciavailable jobs, with no inbound networking requirements.  Jobs can
20bf215546Sopenharmony_cihave tags, so we can have DUT-specific jobs that only run on runners
21bf215546Sopenharmony_ciwith that tag marked in the GitLab UI.
22bf215546Sopenharmony_ci
23bf215546Sopenharmony_ciSince dEQP takes a long time to run, we mark the job as "parallel" at
24bf215546Sopenharmony_cisome level, which spawns multiple jobs from one definition, and then
25bf215546Sopenharmony_cideqp-runner.sh takes the corresponding fraction of the test list for
26bf215546Sopenharmony_cithat job.
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ciTo reduce dEQP runtime (or avoid tests with unreliable results), a
29bf215546Sopenharmony_cideqp-runner.sh invocation can provide a list of tests to skip.  If
30bf215546Sopenharmony_ciyour driver is not yet conformant, you can pass a list of expected
31bf215546Sopenharmony_cifailures, and the job will only fail on tests that aren't listed (look
32bf215546Sopenharmony_ciat the job's log for which specific tests failed).
33bf215546Sopenharmony_ci
34bf215546Sopenharmony_ciDUT requirements
35bf215546Sopenharmony_ci----------------
36bf215546Sopenharmony_ci
37bf215546Sopenharmony_ciIn addition to the general :ref:`CI-farm-expectations`, using
38bf215546Sopenharmony_ciDocker requires:
39bf215546Sopenharmony_ci
40bf215546Sopenharmony_ci* DUTs must have a stable kernel and GPU reset (if applicable).
41bf215546Sopenharmony_ci
42bf215546Sopenharmony_ciIf the system goes down during a test run, that job will eventually
43bf215546Sopenharmony_citime out and fail (default 1 hour).  However, if the kernel can't
44bf215546Sopenharmony_cireliably reset the GPU on failure, bugs in one MR may leak into
45bf215546Sopenharmony_cispurious failures in another MR.  This would be an unacceptable impact
46bf215546Sopenharmony_cion Mesa developers working on other drivers.
47bf215546Sopenharmony_ci
48bf215546Sopenharmony_ci* DUTs must be able to run Docker
49bf215546Sopenharmony_ci
50bf215546Sopenharmony_ciThe Mesa gitlab-runner based test architecture is built around Docker,
51bf215546Sopenharmony_ciso that we can cache the Debian package installation and CTS build
52bf215546Sopenharmony_cistep across multiple test runs.  Since the images are large and change
53bf215546Sopenharmony_ciapproximately weekly, the DUTs also need to be running some script to
54bf215546Sopenharmony_ciprune stale Docker images periodically in order to not run out of disk
55bf215546Sopenharmony_cispace as we rev those containers (perhaps `this script
56bf215546Sopenharmony_ci<https://gitlab.com/gitlab-org/gitlab-runner/issues/2980#note_169233611>`_).
57bf215546Sopenharmony_ci
58bf215546Sopenharmony_ciNote that Docker doesn't allow containers to be stored on NFS, and
59bf215546Sopenharmony_cidoesn't allow multiple Docker daemons to interact with the same
60bf215546Sopenharmony_cinetwork block device, so you will probably need some sort of physical
61bf215546Sopenharmony_cistorage on your DUTs.
62bf215546Sopenharmony_ci
63bf215546Sopenharmony_ci* DUTs must be public
64bf215546Sopenharmony_ci
65bf215546Sopenharmony_ciBy including your device in .gitlab-ci.yml, you're effectively letting
66bf215546Sopenharmony_cianyone on the internet run code on your device.  Docker containers may
67bf215546Sopenharmony_ciprovide some limited protection, but how much you trust that and what
68bf215546Sopenharmony_ciyou do to mitigate hostile access is up to you.
69bf215546Sopenharmony_ci
70bf215546Sopenharmony_ci* DUTs must expose the dri device nodes to the containers.
71bf215546Sopenharmony_ci
72bf215546Sopenharmony_ciObviously, to get access to the HW, we need to pass the render node
73bf215546Sopenharmony_cithrough.  This is done by adding ``devices = ["/dev/dri"]`` to the
74bf215546Sopenharmony_ci``runners.docker`` section of /etc/gitlab-runner/config.toml.
75