From ae1fe43bb031346a34bb00d102457f576fb2a238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Behrmann?= Date: Tue, 12 Mar 2024 17:56:27 +0100 Subject: [PATCH 1/2] arch: install dbus-broker and dbus-broker-units explicitly dbus and dbus-units have been split in Arch recently. Currently everything seems to be pulled in CI, let's see whether we can get this down to just dbus-broker. --- mkosi.conf.d/20-arch.conf | 2 ++ mkosi/resources/mkosi-tools/mkosi.conf.d/10-arch.conf | 2 ++ 2 files changed, 4 insertions(+) diff --git a/mkosi.conf.d/20-arch.conf b/mkosi.conf.d/20-arch.conf index 660dae526..f2743ac69 100644 --- a/mkosi.conf.d/20-arch.conf +++ b/mkosi.conf.d/20-arch.conf @@ -15,6 +15,8 @@ Packages= coreutils cpio curl + dbus-broker + dbus-broker-units debian-archive-keyring dnf dosfstools diff --git a/mkosi/resources/mkosi-tools/mkosi.conf.d/10-arch.conf b/mkosi/resources/mkosi-tools/mkosi.conf.d/10-arch.conf index 058b85f6e..4bc825f94 100644 --- a/mkosi/resources/mkosi-tools/mkosi.conf.d/10-arch.conf +++ b/mkosi/resources/mkosi-tools/mkosi.conf.d/10-arch.conf @@ -10,6 +10,8 @@ Packages= base btrfs-progs curl + dbus-broker + dbus-broker-units debian-archive-keyring dpkg edk2-ovmf From 3eebd34ba04fb2655d213e7c6fe97ca82c98fb00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Behrmann?= Date: Tue, 12 Mar 2024 16:16:29 +0100 Subject: [PATCH 2/2] ci: print group section lines for GitHub workflow Partially fixes: #2361 --- .github/workflows/ci.yml | 3 ++- tests/__init__.py | 13 +++++++++++++ tests/conftest.py | 9 ++++++++- tests/test_initrd.py | 22 +++++++++++++--------- 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7148a70b0..1a86bb32a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -174,7 +174,8 @@ jobs: - name: Run integration tests run: | - sudo timeout -k 30 1h python3 -m pytest \ + sudo --preserve-env \ + timeout -k 30 1h python3 -m pytest \ --tb=no \ --capture=no \ --verbose \ diff --git a/tests/__init__.py b/tests/__init__.py index 6363cc635..3b5b59cce 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,5 +1,6 @@ # SPDX-License-Identifier: LGPL-2.1+ +import contextlib import os import subprocess import sys @@ -166,3 +167,15 @@ def suspend_capture_stdin(pytestconfig: Any) -> Iterator[None]: if pytestconfig.getoption("capture") == "no": capmanager.resume_global_capture() + + +@contextlib.contextmanager +def ci_group(s: str) -> Iterator[None]: + github_actions = os.getenv("GITHUB_ACTIONS") + if github_actions: + print(f"\n::group::{s}", flush=True) + try: + yield + finally: + if github_actions: + print("\n::endgroup::", flush=True) diff --git a/tests/conftest.py b/tests/conftest.py index 641dfedf6..5de10c8ad 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ # SPDX-License-Identifier: LGPL-2.1+ +from collections.abc import Iterator from typing import Any, cast import pytest @@ -6,7 +7,7 @@ from mkosi.config import parse_config from mkosi.distributions import Distribution, detect_distribution -from . import Image +from . import Image, ci_group def pytest_addoption(parser: Any) -> None: @@ -50,3 +51,9 @@ def config(request: Any) -> Image.Config: tools_tree_distribution=cast(Distribution, request.config.getoption("--tools-tree-distribution")), debug_shell=request.config.getoption("--debug-shell"), ) + + +@pytest.fixture(autouse=True) +def ci_sections(request: Any) -> Iterator[None]: + with ci_group(request.node.name): + yield diff --git a/tests/test_initrd.py b/tests/test_initrd.py index 6df167ec5..38ae11354 100644 --- a/tests/test_initrd.py +++ b/tests/test_initrd.py @@ -8,6 +8,7 @@ import time from collections.abc import Iterator from pathlib import Path +from typing import Any import pytest @@ -20,7 +21,7 @@ from mkosi.user import INVOKING_USER from mkosi.versioncomp import GenericVersion -from . import Image +from . import Image, ci_group pytestmark = pytest.mark.integration @@ -39,14 +40,17 @@ def passphrase() -> Iterator[Path]: @pytest.fixture(scope="module") -def initrd(config: Image.Config) -> Iterator[Image]: - with Image( - config, - options=[ - "--directory", "", - "--include=mkosi-initrd/", - ], - ) as initrd: +def initrd(request: Any, config: Image.Config) -> Iterator[Image]: + with ( + ci_group(f"Initrd image {config.distribution}/{config.release}"), + Image( + config, + options=[ + "--directory", "", + "--include=mkosi-initrd/", + ], + ) as initrd + ): if initrd.config.distribution == Distribution.rhel_ubi: pytest.skip("Cannot build RHEL-UBI initrds")