|
1 | 1 | ---
|
2 | 2 | title: "Developer Documentation"
|
3 |
| -date: 2024-05-22 |
| 3 | +date: 2024-06-18 |
4 | 4 | description: "KernelCI Pipeline developer manual"
|
5 | 5 | weight: 4
|
6 | 6 | ---
|
@@ -50,3 +50,72 @@ build_configs:
|
50 | 50 |
|
51 | 51 | That's it! The tree is enabled now.
|
52 | 52 | All the jobs defined under `jobs` section of [config file](https://github.com/kernelci/kernelci-pipeline/blob/main/config/pipeline.yaml) would run on the newly added tree until specified otherwise.
|
| 53 | + |
| 54 | + |
| 55 | +## Enabling a new test |
| 56 | + |
| 57 | +KernelCI currently runs several test suites. This manual is intended |
| 58 | +to provide documentation for developers on how to enable new tests. |
| 59 | + |
| 60 | + |
| 61 | +### Job definition |
| 62 | +The pipeline [configuration](https://github.com/kernelci/kernelci-pipeline/blob/main/config/pipeline.yaml) file has `jobs` section for defining various build and test jobs. The currently enabled tests are `kver`, `baseline`, `kunit`, `kselftest`, and `sleep` tests. |
| 63 | +`ChromeOS` specific job definitions are located in [config/jobs-chromeos.yaml](https://github.com/kernelci/kernelci-pipeline/blob/main/config/jobs-chromeos.yaml) file. |
| 64 | + |
| 65 | +To enable a new test, an entry needs to be added as follows: |
| 66 | + |
| 67 | +```yaml |
| 68 | +jobs: |
| 69 | + <job-name>: |
| 70 | + template: <job-template> |
| 71 | + kind: <kind of job, either 'kbuild', 'job' or 'test'> |
| 72 | + image: <docker-image-name> |
| 73 | + params: <parameters such as arch, compiler, defconfig> |
| 74 | + rules: <job-rules> |
| 75 | + kcidb_test_suite: <kcidb-mapping> |
| 76 | +``` |
| 77 | + |
| 78 | +Here is the description of each field: |
| 79 | +- A `jinja2` template should be added to [`config/runtime`](https://github.com/kernelci/kernelci-pipeline/tree/main/config/runtime) directory. |
| 80 | +The template will be used to generate test definition. |
| 81 | +- `kind` field denotes type of the job. It should be `kbuild` for build jobs, `job` for a test suite, and simply `test` for a single test case. |
| 82 | +- `image` field specifies the Docker image used for building and running the test. |
| 83 | +- `params` includes parameters used for building the kernel (for `kbuild` job) or running the test, such as architecture, compiler, defconfig option, job timeout, etc. |
| 84 | +- `rules` will define job rules. If the test should be scheduled for specific kernel tree, branch, or version, these rules can be defined in this section. |
| 85 | +- `kcidb_test_suite` is a field used to map KernelCI test suite name with |
| 86 | +KCIDB test. Build jobs (with `kind: kbuild`) do not require this field. |
| 87 | + |
| 88 | +Please have a look at [config/pipeline.yaml](https://github.com/kernelci/kernelci-pipeline/blob/main/config/pipeline.yaml) and [config/jobs-chromeos.yaml](https://github.com/kernelci/kernelci-pipeline/blob/main/config/jobs-chromeos.yaml) files to check currently added job definitions for reference. |
| 89 | + |
| 90 | + |
| 91 | +### Schedule the job |
| 92 | + |
| 93 | +We also need a `scheduler` entry for the newly added job to specify pre-conditions for scheduling and define runtime and platforms for job submissions. |
| 94 | + |
| 95 | +For example, |
| 96 | +```yaml |
| 97 | +scheduler: |
| 98 | + - job: <job-name> |
| 99 | + event: <API-pubsub-event> |
| 100 | + runtime: |
| 101 | + type: <runtime-type> |
| 102 | + name: <runtime-name> |
| 103 | + platforms: |
| 104 | + - <device-type> |
| 105 | +``` |
| 106 | + |
| 107 | +Here is the description of each field: |
| 108 | +- `job` field specifies the job name, which must match the name used in the jobs section |
| 109 | +- `event` specifies the API PubSub event triggering the test scheduling. |
| 110 | +For example, if the test requires a build job such as `kbuild-gcc-10-arm64` |
| 111 | +to be successfully completed, specify the event as follows: |
| 112 | +``` |
| 113 | +event: |
| 114 | + channel: node |
| 115 | + name: kbuild-gcc-10-arm64 |
| 116 | + result: pass |
| 117 | +``` |
| 118 | +- Choose a `runtime` for scheduling and running the job. Currently supported runtimes are shell, docker, lava, and kubernetes. Select a runtime type from `runtimes` section. Please note that `name` property is required for `lava` and `k8s` runtimes to specify which lab/k8s context should run the test as number of LAVA labs such as BayLibre, Collabora, Qualcomm and k8s contexts have been enabled in KernelCI. |
| 119 | +- `platforms` will include a list of device types on which the test should run. It should match entries defined in `platforms` section such as `qemu-x86`, `bcm2711-rpi-4-b`, and so on. |
| 120 | + |
| 121 | +That's pretty much it. After following the above steps, run your pipeline instance and you are good to go with your newly added test! |
0 commit comments