1 | LAVA CI
|
---|
2 | =======
|
---|
3 |
|
---|
4 | `LAVA <https://www.lavasoftware.org/>`__ is a system for functional
|
---|
5 | testing of boards including deploying custom bootloaders and kernels.
|
---|
6 | This is particularly relevant to testing Mesa because we often need
|
---|
7 | to change kernels for UAPI changes (and this lets us do full testing
|
---|
8 | of a new kernel during development), and our workloads can easily
|
---|
9 | take down boards when mistakes are made (kernel oopses, OOMs that
|
---|
10 | take out critical system services).
|
---|
11 |
|
---|
12 | Available LAVA labs
|
---|
13 | -------------------
|
---|
14 | - Collabora `[dashboard] <https://lava.collabora.dev/scheduler/device_types>`__ (without authentication only health check jobs are displayed)
|
---|
15 | - Lima [dashboard not available]
|
---|
16 |
|
---|
17 | Mesa-LAVA software architecture
|
---|
18 | -------------------------------
|
---|
19 |
|
---|
20 | The gitlab-runner will run on some host that has access to the LAVA
|
---|
21 | lab, with tags like "mesa-ci-x86-64-lava-$DEVICE_TYPE" to control only
|
---|
22 | taking in jobs for the hardware that the LAVA lab contains. The
|
---|
23 | gitlab-runner spawns a Docker container with lavacli in it, and
|
---|
24 | connects to the LAVA lab using a predefined token to submit jobs under
|
---|
25 | a specific device type.
|
---|
26 |
|
---|
27 | The LAVA instance manages scheduling those jobs to the boards present.
|
---|
28 | For a job, it will deploy the kernel, device tree, and the ramdisk
|
---|
29 | containing the CTS.
|
---|
30 |
|
---|
31 | Deploying a new Mesa-LAVA lab
|
---|
32 | -----------------------------
|
---|
33 |
|
---|
34 | You'll want to start with setting up your LAVA instance and getting
|
---|
35 | some boards booting using test jobs. Start with the stock QEMU
|
---|
36 | examples to make sure your instance works at all. Then, you'll need
|
---|
37 | to define your actual boards.
|
---|
38 |
|
---|
39 | The device type in lava-gitlab-ci.yml is the device type you create in
|
---|
40 | your LAVA instance, which doesn't have to match the board's name in
|
---|
41 | ``/etc/lava-dispatcher/device-types``. You create your boards under
|
---|
42 | that device type and the Mesa jobs will be scheduled to any of them.
|
---|
43 | Instantiate your boards by creating them in the UI or at the command
|
---|
44 | line attached to that device type, then populate their dictionary
|
---|
45 | (using an "extends" line probably referencing the board's template in
|
---|
46 | ``/etc/lava-dispatcher/device-types``). Now, go find a relevant
|
---|
47 | health check job for your board as a test job definition, or cobble
|
---|
48 | something together from a board that boots using the same boot_method
|
---|
49 | and some public images, and figure out how to get your boards booting.
|
---|
50 |
|
---|
51 | Once you can boot your board using a custom job definition, it's time
|
---|
52 | to connect Mesa CI to it. Install gitlab-runner and register as a
|
---|
53 | shared runner (you'll need a GitLab admin for help with this). The
|
---|
54 | runner *must* have a tag (like "mesa-ci-x86-64-lava-rk3399-gru-kevin")
|
---|
55 | to restrict the jobs it takes or it will grab random jobs from tasks
|
---|
56 | across ``gitlab.freedesktop.org``, and your runner isn't ready for
|
---|
57 | that.
|
---|
58 |
|
---|
59 | The Docker image will need access to the LAVA instance. If it's on a
|
---|
60 | public network it should be fine. If you're running the LAVA instance
|
---|
61 | on localhost, you'll need to set ``network_mode="host"`` in
|
---|
62 | ``/etc/gitlab-runner/config.toml`` so it can access localhost. Create a
|
---|
63 | gitlab-runner user in your LAVA instance, log in under that user on
|
---|
64 | the web interface, and create an API token. Copy that into a
|
---|
65 | ``lavacli.yaml``:
|
---|
66 |
|
---|
67 | .. code-block:: yaml
|
---|
68 |
|
---|
69 | default:
|
---|
70 | token: <token contents>
|
---|
71 | uri: <URL to the instance>
|
---|
72 | username: gitlab-runner
|
---|
73 |
|
---|
74 | Add a volume mount of that ``lavacli.yaml`` to
|
---|
75 | ``/etc/gitlab-runner/config.toml`` so that the Docker container can
|
---|
76 | access it. You probably have a ``volumes = ["/cache"]`` already, so now it would be::
|
---|
77 |
|
---|
78 | volumes = ["/home/anholt/lava-config/lavacli.yaml:/root/.config/lavacli.yaml", "/cache"]
|
---|
79 |
|
---|
80 | Note that this token is visible to anybody that can submit MRs to
|
---|
81 | Mesa! It is not an actual secret. We could just bake it into the
|
---|
82 | GitLab CI YAML, but this way the current method of connecting to the
|
---|
83 | LAVA instance is separated from the Mesa branches (particularly
|
---|
84 | relevant as we have many stable branches all using CI).
|
---|
85 |
|
---|
86 | Now it's time to define your test jobs in the driver-specific
|
---|
87 | gitlab-ci.yml file, using the device-specific tags.
|
---|