From 0bf2e3c712b71d7df184116c972bbf643ee76b2b Mon Sep 17 00:00:00 2001 From: Valentine Burley Date: Fri, 4 Jul 2025 09:07:10 +0200 Subject: [PATCH] ci/lava: Use UART for non-Chromebooks Some Chromebooks have unreliable UART, so we fall back to SSH for them. However, SSH setup adds a 10-15s overhead, so we now restrict its usage to devices with the "depthcharge" boot method (i.e., Chromebooks). Signed-off-by: Valentine Burley Part-of: --- .gitlab-ci/image-tags.yml | 2 +- .gitlab-ci/lava/utils/lava_farm.py | 13 +++++++++++++ .gitlab-ci/lava/utils/lava_job_definition.py | 12 ++++++++---- .gitlab-ci/tests/utils/test_lava_job_definition.py | 3 ++- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci/image-tags.yml b/.gitlab-ci/image-tags.yml index 0efa58fa9ed..0bbca0b59ae 100644 --- a/.gitlab-ci/image-tags.yml +++ b/.gitlab-ci/image-tags.yml @@ -30,7 +30,7 @@ variables: ALPINE_X86_64_BUILD_TAG: "20250709-libwayland" ALPINE_X86_64_LAVA_SSH_TAG: "20250423-rootfs" - ALPINE_X86_64_LAVA_TRIGGER_TAG: "20250619-cts-ovl" + ALPINE_X86_64_LAVA_TRIGGER_TAG: "20250701-uart" FEDORA_X86_64_BUILD_TAG: "20250709-libwayland" diff --git a/.gitlab-ci/lava/utils/lava_farm.py b/.gitlab-ci/lava/utils/lava_farm.py index 1a0bbecb378..a4c49c138c5 100644 --- a/.gitlab-ci/lava/utils/lava_farm.py +++ b/.gitlab-ci/lava/utils/lava_farm.py @@ -18,3 +18,16 @@ def get_lava_farm() -> str: logging.warning("FARM environment variable is not set, using unknown") return farm.lower() + +def get_lava_boot_method() -> str: + """ + Returns the LAVA boot method based on the BOOT_METHOD environment variable. + + :return: The LAVA boot method + """ + boot_method: str = os.getenv("BOOT_METHOD", "unknown") + + if boot_method == "unknown": + logging.warning("BOOT_METHOD environment variable is not set, using unknown") + + return boot_method.lower() diff --git a/.gitlab-ci/lava/utils/lava_job_definition.py b/.gitlab-ci/lava/utils/lava_job_definition.py index 1bbd2c06265..2b00550c35b 100644 --- a/.gitlab-ci/lava/utils/lava_job_definition.py +++ b/.gitlab-ci/lava/utils/lava_job_definition.py @@ -11,7 +11,7 @@ from ruamel.yaml import YAML from os import getenv -from lava.utils.lava_farm import get_lava_farm +from lava.utils.lava_farm import get_lava_farm, get_lava_boot_method from lava.utils.log_section import LAVA_DEPLOY_TIMEOUT from lava.utils.ssh_job_definition import ( generate_docker_test, @@ -60,11 +60,15 @@ class LAVAJobDefinition: if FORCE_UART: return False - # Only Collabora's farm supports to run docker container as a LAVA actions, - # which is required to follow the job in a SSH section current_farm = get_lava_farm() + boot_method = get_lava_boot_method() - return current_farm == "collabora" + # Some Chromebooks have unreliable serial connections, so SSH is preferred. + # Only Collabora's farm supports running docker container as a LAVA actions, + # which is required to follow the job in an SSH section + # Chromebooks use the "depthcharge" boot method, so use SSH in that case, + # and UART for everything else. + return current_farm == "collabora" and boot_method == "depthcharge" def generate_lava_yaml_payload(self) -> dict[str, Any]: """ diff --git a/.gitlab-ci/tests/utils/test_lava_job_definition.py b/.gitlab-ci/tests/utils/test_lava_job_definition.py index 05f6643e3cc..579a3393374 100644 --- a/.gitlab-ci/tests/utils/test_lava_job_definition.py +++ b/.gitlab-ci/tests/utils/test_lava_job_definition.py @@ -85,8 +85,9 @@ def clear_env_vars(autouse=True): @pytest.fixture def mock_collabora_farm(clear_env_vars, monkeypatch): - # Mock a Collabora farm-like device runner tag to enable SSH execution + # Mock a Chromebook in the Collabora farm monkeypatch.setenv("FARM", "collabora") + monkeypatch.setenv("BOOT_METHOD", "depthcharge") @pytest.mark.parametrize("force_uart", [True, False], ids=["SSH", "UART"])