ci: Add a minimal Alpine container for running LAVA jobs

Compared to the existing Debian-based x86_64_pyutils container, this
Alpine-based variant reduces the image size by approximately 83%.

Include all the necessary python artifacts, including lava_job_submitter
in the container to avoid having to download them at the start of each
test job.

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34980>
This commit is contained in:
Valentine Burley 2025-05-14 12:21:44 +02:00 committed by Marge Bot
parent f83e830dbc
commit f6dce6dee1
28 changed files with 149 additions and 18 deletions

View file

@ -382,6 +382,7 @@ sanity:
image_tags=( image_tags=(
ALPINE_X86_64_BUILD_TAG ALPINE_X86_64_BUILD_TAG
ALPINE_X86_64_LAVA_SSH_TAG ALPINE_X86_64_LAVA_SSH_TAG
ALPINE_X86_64_LAVA_TRIGGER_TAG
DEBIAN_BASE_TAG DEBIAN_BASE_TAG
DEBIAN_BUILD_TAG DEBIAN_BUILD_TAG
DEBIAN_PYUTILS_TAG DEBIAN_PYUTILS_TAG

View file

@ -3,6 +3,10 @@
# Very early init, used to make sure devices and network are set up and # Very early init, used to make sure devices and network are set up and
# reachable. # reachable.
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG
set -ex set -ex
cd / cd /

View file

@ -0,0 +1,50 @@
#!/usr/bin/env bash
# This is a ci-templates build script to generate a container for triggering LAVA jobs.
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG
# shellcheck disable=SC1091
set -e
. .gitlab-ci/setup-test-env.sh
set -o xtrace
uncollapsed_section_start alpine_setup "Base Alpine system setup"
# Ephemeral packages (installed for this script and removed again at the end)
EPHEMERAL=(
git
py3-pip
)
# We only need these very basic packages to run the LAVA jobs
DEPS=(
curl
python3
tar
zstd
)
apk --no-cache add "${DEPS[@]}" "${EPHEMERAL[@]}"
pip3 install --break-system-packages -r bin/ci/requirements-lava.txt
cp -Rp .gitlab-ci/lava /
cp -Rp .gitlab-ci/bin/*_logger.py /lava
cp -Rp .gitlab-ci/common/init-stage1.sh /lava
. .gitlab-ci/container/container_pre_build.sh
############### Uninstall the build software
uncollapsed_section_switch alpine_cleanup "Cleaning up base Alpine system"
apk del "${EPHEMERAL[@]}"
. .gitlab-ci/container/container_post_build.sh
section_end alpine_cleanup

View file

@ -339,6 +339,13 @@ alpine/x86_64_lava_ssh_client:
variables: variables:
MESA_IMAGE_TAG: &alpine-x86_64_lava_ssh_client ${ALPINE_X86_64_LAVA_SSH_TAG} MESA_IMAGE_TAG: &alpine-x86_64_lava_ssh_client ${ALPINE_X86_64_LAVA_SSH_TAG}
# Alpine based x86_64 image to run LAVA jobs
alpine/x86_64_lava-trigger:
extends:
- .alpine/x86_64_build-base
variables:
MESA_IMAGE_TAG: &alpine-x86_64_lava_trigger ${ALPINE_X86_64_LAVA_TRIGGER_TAG}
# Fedora based x86_64 build image # Fedora based x86_64 build image
fedora/x86_64_build: fedora/x86_64_build:
extends: extends:

View file

@ -32,6 +32,8 @@ variables:
ALPINE_X86_64_BUILD_TAG: "20250423-rootfs" ALPINE_X86_64_BUILD_TAG: "20250423-rootfs"
ALPINE_X86_64_LAVA_SSH_TAG: "20250423-rootfs" ALPINE_X86_64_LAVA_SSH_TAG: "20250423-rootfs"
ALPINE_X86_64_LAVA_TRIGGER_TAG: "20250526-byeutils"
FEDORA_X86_64_BUILD_TAG: "20250423-rootfs" FEDORA_X86_64_BUILD_TAG: "20250423-rootfs"
KERNEL_TAG: "v6.14-mesa-dea4" KERNEL_TAG: "v6.14-mesa-dea4"

View file

@ -0,0 +1,3 @@
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG

View file

@ -1,3 +1,7 @@
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG
from datetime import timedelta from datetime import timedelta

View file

@ -3,6 +3,17 @@ variables:
.lava-test: .lava-test:
# LAVA relies on two main containers:
# 1. alpine/x86_64_lava-trigger - the container used on the GitLab CI runner
# 2. the test-* container (e.g. debian/arm64_test-vk), whose derived rootfs
# is used on the DUT
# The following two containers are also used:
# 3. alpine/x86_64_lava_ssh_client - the slim SSH client container for jobs
# that use SSH instead of UART as job output
# 4. lava/health-check-docker - the slim container used for fastboot
# Set image: directly instead of extending .set-image to avoid conflicts
# with MESA_IMAGE_PATH and FDO_DISTRIBUTION_TAG between the containers.
image: "${CI_REGISTRY_IMAGE}/alpine/x86_64_lava-trigger:${ALPINE_X86_64_LAVA_TRIGGER_TAG}--${MESA_TEMPLATES_COMMIT}"
# Cancel job if a newer commit is pushed to the same branch # Cancel job if a newer commit is pushed to the same branch
interruptible: true interruptible: true
# The jobs themselves shouldn't actually run for an hour, of course. # The jobs themselves shouldn't actually run for an hour, of course.
@ -31,15 +42,11 @@ variables:
# per-job build artifacts # per-job build artifacts
JOB_RESULTS_PATH: "${JOB_ARTIFACTS_BASE}/results.tar.zst" JOB_RESULTS_PATH: "${JOB_ARTIFACTS_BASE}/results.tar.zst"
LAVA_S3_ARTIFACT_NAME: "mesa-${ARCH}-default-debugoptimized" LAVA_S3_ARTIFACT_NAME: "mesa-${ARCH}-default-debugoptimized"
S3_ARTIFACT_NAME: "mesa-python-ci-artifacts"
S3_RESULTS_UPLOAD: "${JOB_ARTIFACTS_BASE}" S3_RESULTS_UPLOAD: "${JOB_ARTIFACTS_BASE}"
PIGLIT_NO_WINDOW: 1 PIGLIT_NO_WINDOW: 1
VISIBILITY_GROUP: "Collabora+fdo" VISIBILITY_GROUP: "Collabora+fdo"
before_script:
- !reference [.download_s3, before_script]
script: script:
- . artifacts/setup-test-env.sh - /lava/lava-submit.sh
- ./artifacts/lava/lava-submit.sh
artifacts: artifacts:
name: "${CI_PROJECT_NAME}_${CI_JOB_NAME}" name: "${CI_PROJECT_NAME}_${CI_JOB_NAME}"
when: always when: always
@ -57,9 +64,7 @@ variables:
- !reference [.required-for-hardware-jobs, needs] - !reference [.required-for-hardware-jobs, needs]
- job: alpine/x86_64_lava_ssh_client - job: alpine/x86_64_lava_ssh_client
artifacts: false artifacts: false
- job: debian/x86_64_pyutils - job: alpine/x86_64_lava-trigger
artifacts: false
- job: python-artifacts
artifacts: false artifacts: false
.lava-x86_64-test: .lava-x86_64-test:
@ -70,7 +75,6 @@ variables:
KERNEL_IMAGE_TYPE: "zimage" KERNEL_IMAGE_TYPE: "zimage"
BOOT_METHOD: u-boot BOOT_METHOD: u-boot
extends: extends:
- .use-debian/x86_64_pyutils
- .lava-test - .lava-test
needs: needs:
- !reference [.lava-test, needs] - !reference [.lava-test, needs]
@ -115,7 +119,6 @@ variables:
KERNEL_IMAGE_TYPE: "zimage" KERNEL_IMAGE_TYPE: "zimage"
BOOT_METHOD: u-boot BOOT_METHOD: u-boot
extends: extends:
- .use-debian/x86_64_pyutils
- .lava-test - .lava-test
needs: needs:
- !reference [.lava-test, needs] - !reference [.lava-test, needs]
@ -140,7 +143,6 @@ variables:
KERNEL_IMAGE_TYPE: "image" KERNEL_IMAGE_TYPE: "image"
BOOT_METHOD: u-boot BOOT_METHOD: u-boot
extends: extends:
- .use-debian/x86_64_pyutils
- .lava-test - .lava-test
needs: needs:
- !reference [.lava-test, needs] - !reference [.lava-test, needs]

View file

@ -2,6 +2,10 @@
# shellcheck disable=SC2086 # we want word splitting # shellcheck disable=SC2086 # we want word splitting
# shellcheck disable=SC1091 # paths only become valid at runtime # shellcheck disable=SC1091 # paths only become valid at runtime
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG
# If we run in the fork (not from mesa or Marge-bot), reuse mainline kernel and rootfs, if exist. # If we run in the fork (not from mesa or Marge-bot), reuse mainline kernel and rootfs, if exist.
_check_artifact_path() { _check_artifact_path() {
_url="https://${1}/${2}" _url="https://${1}/${2}"
@ -76,7 +80,7 @@ if [ -n "${LAVA_FIRMWARE:-}" ]; then
done done
fi fi
PYTHONPATH=artifacts/ artifacts/lava/lava_job_submitter.py \ PYTHONPATH=/ /lava/lava_job_submitter.py \
--farm "${FARM}" \ --farm "${FARM}" \
--device-type "${DEVICE_TYPE}" \ --device-type "${DEVICE_TYPE}" \
--boot-method "${BOOT_METHOD}" \ --boot-method "${BOOT_METHOD}" \
@ -86,7 +90,7 @@ PYTHONPATH=artifacts/ artifacts/lava/lava_job_submitter.py \
--rootfs-url "${ROOTFS_URL}" \ --rootfs-url "${ROOTFS_URL}" \
--kernel-url-prefix "${KERNEL_IMAGE_BASE}/${DEBIAN_ARCH}" \ --kernel-url-prefix "${KERNEL_IMAGE_BASE}/${DEBIAN_ARCH}" \
--dtb-filename "${DTB}" \ --dtb-filename "${DTB}" \
--first-stage-init artifacts/ci-common/init-stage1.sh \ --first-stage-init /lava/init-stage1.sh \
--env-file dut-env-vars.sh \ --env-file dut-env-vars.sh \
--jwt-file "${S3_JWT_FILE}" \ --jwt-file "${S3_JWT_FILE}" \
--kernel-image-name "${KERNEL_IMAGE_NAME}" \ --kernel-image-name "${KERNEL_IMAGE_NAME}" \

View file

@ -7,6 +7,10 @@
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG
"""Send a job to LAVA, track it and collect log back""" """Send a job to LAVA, track it and collect log back"""
import contextlib import contextlib

View file

@ -1,3 +1,7 @@
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG
from .console_format import CONSOLE_LOG from .console_format import CONSOLE_LOG
from .gitlab_section import GitlabSection from .gitlab_section import GitlabSection
from .lava_job import LAVAJob from .lava_job import LAVAJob

View file

@ -1,3 +1,7 @@
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG
CONSOLE_LOG = { CONSOLE_LOG = {
"FG_GREEN": "\x1b[0;32m", "FG_GREEN": "\x1b[0;32m",
"FG_BOLD_GREEN": "\x1b[0;1;32m", "FG_BOLD_GREEN": "\x1b[0;1;32m",

View file

@ -1,3 +1,7 @@
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG
from os import getenv from os import getenv
# How many attempts should be made when a timeout happen during LAVA device boot. # How many attempts should be made when a timeout happen during LAVA device boot.

View file

@ -1,3 +1,7 @@
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG
from __future__ import annotations from __future__ import annotations
import re import re

View file

@ -1,3 +1,7 @@
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG
import logging import logging
import os import os

View file

@ -1,3 +1,7 @@
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG
import re import re
import xmlrpc import xmlrpc
from collections import defaultdict from collections import defaultdict

View file

@ -1,3 +1,7 @@
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG
from io import StringIO from io import StringIO
from typing import TYPE_CHECKING, Any from typing import TYPE_CHECKING, Any
import base64 import base64

View file

@ -1,3 +1,7 @@
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG
from __future__ import annotations from __future__ import annotations
import re import re

View file

@ -1,3 +1,7 @@
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG
import time import time
import traceback import traceback
import urllib import urllib

View file

@ -5,6 +5,10 @@
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG
""" """
Some utilities to analyse logs, create gitlab sections and other quality of life Some utilities to analyse logs, create gitlab sections and other quality of life
improvements improvements

View file

@ -1,3 +1,7 @@
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG
import re import re
from dataclasses import dataclass from dataclasses import dataclass
from datetime import datetime, timedelta from datetime import datetime, timedelta

View file

@ -1,3 +1,7 @@
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG
""" """
In a few words: some devices in Mesa CI has problematic serial connection, they In a few words: some devices in Mesa CI has problematic serial connection, they
may hang (become silent) intermittently. Every time it hangs for minutes, the may hang (become silent) intermittently. Every time it hangs for minutes, the

View file

@ -1,3 +1,7 @@
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG
from typing import TYPE_CHECKING, Any from typing import TYPE_CHECKING, Any
if TYPE_CHECKING: if TYPE_CHECKING:

View file

@ -122,7 +122,6 @@
LAVA_TAGS: "cbg-0" LAVA_TAGS: "cbg-0"
# Ensure that we are using the release build artifact # Ensure that we are using the release build artifact
LAVA_S3_ARTIFACT_NAME: mesa-${ARCH}-default-release LAVA_S3_ARTIFACT_NAME: mesa-${ARCH}-default-release
S3_ARTIFACT_NAME: mesa-python-ci-artifacts
# Reset dependencies in performance jobs to enforce the release build artifact # Reset dependencies in performance jobs to enforce the release build artifact
dependencies: null dependencies: null
# Don't run in parallel. It is okay to performance jobs to take a little # Don't run in parallel. It is okay to performance jobs to take a little

View file

@ -1,3 +1,6 @@
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# ALPINE_X86_64_LAVA_TRIGGER_TAG
filelock==3.* filelock==3.*
fire==0.5.0 fire==0.5.0
lavacli==2.2.0 lavacli==2.2.0

View file

@ -215,7 +215,6 @@
JOB_PRIORITY: 40 JOB_PRIORITY: 40
# Ensure that we are using the release build artifact # Ensure that we are using the release build artifact
LAVA_S3_ARTIFACT_NAME: mesa-arm64-default-release LAVA_S3_ARTIFACT_NAME: mesa-arm64-default-release
S3_ARTIFACT_NAME: mesa-python-ci-artifacts
needs: needs:
- debian/x86_64_build - debian/x86_64_build
- debian-arm64-release - debian-arm64-release

View file

@ -37,7 +37,6 @@
variables: variables:
JOB_PRIORITY: 40 JOB_PRIORITY: 40
LAVA_S3_ARTIFACT_NAME: mesa-x86_64-default-release LAVA_S3_ARTIFACT_NAME: mesa-x86_64-default-release
S3_ARTIFACT_NAME: mesa-python-ci-artifacts
needs: needs:
- debian/x86_64_test-gl - debian/x86_64_test-gl
- debian-release - debian-release

View file

@ -129,7 +129,6 @@
variables: variables:
JOB_PRIORITY: 40 JOB_PRIORITY: 40
LAVA_S3_ARTIFACT_NAME: mesa-x86_64-default-release LAVA_S3_ARTIFACT_NAME: mesa-x86_64-default-release
S3_ARTIFACT_NAME: mesa-python-ci-artifacts
needs: needs:
- debian/x86_64_test-gl - debian/x86_64_test-gl
- debian-release - debian-release
@ -451,7 +450,6 @@
LAVA_TAGS: "cbg-0" LAVA_TAGS: "cbg-0"
# Ensure that we are using the release build artifact # Ensure that we are using the release build artifact
LAVA_S3_ARTIFACT_NAME: mesa-x86_64-default-release LAVA_S3_ARTIFACT_NAME: mesa-x86_64-default-release
S3_ARTIFACT_NAME: mesa-python-ci-artifacts
.iris-whl-traces-performance: .iris-whl-traces-performance:
extends: extends: