From b3e58cb7fd07019ba282696de6f1578197e0a7d8 Mon Sep 17 00:00:00 2001 From: "peter.marcisovsky" Date: Wed, 4 Dec 2024 15:19:12 +0100 Subject: [PATCH] refactor(device): Update info about Github, Gitlab runner setup --- .../workflows/build_and_run_test_app_usb.yml | 2 +- device/esp_tinyusb/test_apps/README.md | 28 +++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_and_run_test_app_usb.yml b/.github/workflows/build_and_run_test_app_usb.yml index 2bcc4243..771ebb61 100644 --- a/.github/workflows/build_and_run_test_app_usb.yml +++ b/.github/workflows/build_and_run_test_app_usb.yml @@ -65,7 +65,7 @@ jobs: runs-on: [self-hosted, linux, docker, "${{ matrix.idf_target }}", "${{ matrix.runner_tag }}"] container: image: python:3.11-bookworm - options: --privileged --device-cgroup-rule="c 188:* rmw" --device-cgroup-rule="c 166:* rmw" --group-add plugdev + options: --privileged --device-cgroup-rule="c 188:* rmw" --device-cgroup-rule="c 166:* rmw" steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 diff --git a/device/esp_tinyusb/test_apps/README.md b/device/esp_tinyusb/test_apps/README.md index a8d35595..a03e42ae 100644 --- a/device/esp_tinyusb/test_apps/README.md +++ b/device/esp_tinyusb/test_apps/README.md @@ -12,6 +12,8 @@ The main idea comes from this response on [stackoverflow](https://stackoverflow. - [`Docker tty script`](#docker-tty-script) - [`Logging`](#logging) - [`Running a docker container`](#running-a-docker-container) +- [`GitHub CI target runner setup`](#github-ci-target-runner-setup) +- [`GitLab CI target runner setup`](#gitlab-ci-target-runner-setup) ## UDEV rules @@ -101,9 +103,31 @@ crw-rw---- 1 root dialout 166, 1 Nov 13 10:26 /dev/ttyACM1 Run a Docker container with the following extra options: ``` sh -docker run --device-cgroup-rule='c 188:* rmw' --device-cgroup-rule='c 166:* rmw' --group-add plugdev --privileged .. +docker run --device-cgroup-rule='c 188:* rmw' --device-cgroup-rule='c 166:* rmw' --privileged .. ``` - `--device-cgroup-rule='c 188:* rmw'`: allow access to `ttyUSBx` (Major 188, all Minors) - `--device-cgroup-rule='c 166:* rmw'`: allow access to `ttyACMx` (Major 166, all Minors) -- `--group-add plugdev`: add the plugdev group + +## GitHub CI target runner setup + +To apply these changes to a GitHub target runner a `.yml` file used to run a Docker container for pytest must be modified. The Docker container is then run with the following options: + +``` yaml +container: + image: python:3.11-bookworm + options: --privileged --device-cgroup-rule="c 188:* rmw" --device-cgroup-rule="c 166:* rmw" +``` + +## GitLab CI target runner setup + +To apply these changes to a GitLab runner the `config.toml` file located at `/etc/gitlab-runner/config.toml` on each GitLab target runner must be modified. + +According to GitLab's [documentation](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnersdocker-section) the `[runners.docker]` section of the `config.toml` file should include the `device_cgroup_rules` parameter: + +``` toml +[runners.docker] + ... + device_cgroup_rules = ["c 188:* rmw", "c 166:* rmw"] +``` +