From 3d75c09f3563572661e43bb8b580a214183420cb Mon Sep 17 00:00:00 2001 From: Li Zhijian Date: Mon, 18 May 2026 17:08:17 +0800 Subject: [PATCH 1/6] ci-automation: drop git safe.directory for tests The local test runner ./run_local_tests.sh invokes the mantle container with the scripts checkout mounted as /work. When using a git worktree for the scripts directory, git inside the container may see a .git/worktrees path that does not resolve correctly in that environment and fails with: ./run_local_tests.sh ================================= Using Mantle docker image 'ghcr.io/flatcar/mantle:git-ca80a2eaee4cc195ae6e17f9202c1d72e729d460' ================================= Running qemu_uefi tests git-ca80a2eaee4cc195ae6e17f9202c1d72e729d460: Pulling from flatcar/mantle Digest: sha256:cd37c1ba21b8051eb2632e171d4f1f9bc7e91708883575343265d3d58940d5df Status: Image is up to date for ghcr.io/flatcar/mantle:git-ca80a2eaee4cc195ae6e17f9202c1d72e729d460 fatal: not a git repository: ../flatcar/scripts/.git/worktrees/... git-ca80a2eaee4cc195ae6e17f9202c1d72e729d460: Pulling from flatcar/mantle Digest: sha256:cd37c1ba21b8051eb2632e171d4f1f9bc7e91708883575343265d3d58940d5df Status: Image is up to date for ghcr.io/flatcar/mantle:git-ca80a2eaee4cc195ae6e17f9202c1d72e729d460 zstd could not be found. unpacking container image may fail. ci-automation/tapfile_helper_lib.sh: line 167: __TESTS__/qemu_uefi/results-run-1.tap: No such file or directory The tests only need the precomputed git version and channel written on the host side, and do not require running git inside the mantle container. Remove the git safe.directory configuration from the test docker invocation so that the container no longer attempts to operate on the host worktree, avoiding failures in worktree-based setups while keeping CI behavior unchanged. Signed-off-by: Li Zhijian --- ci-automation/test.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ci-automation/test.sh b/ci-automation/test.sh index c8db48edd01..f497ddcac6c 100644 --- a/ci-automation/test.sh +++ b/ci-automation/test.sh @@ -171,8 +171,7 @@ function _test_run_impl() { touch sdk_container/.env docker run --pull always --rm --name="${container_name}" --privileged --net host -v /dev:/dev \ -w /work -v "$PWD":/work "${MANTLE_REF}" \ - bash -c "git config --global --add safe.directory /work && \ - source sdk_container/.env && \ + bash -c "source sdk_container/.env && \ ci-automation/vendor-testing/${image_escaped}.sh ${common_test_args_escaped[*]} ${tapfile_escaped} ${tests_escaped[*]}" set -e rm -f "${work_dir}/first_run" From 04b79d38f22f3be690babe25b9c0502f6e3c6351 Mon Sep 17 00:00:00 2001 From: Li Zhijian Date: Mon, 18 May 2026 17:45:21 +0800 Subject: [PATCH 2/6] ci-automation: document run_local_tests.sh usage run_local_tests.sh wraps ci-automation/test.sh for local qemu_uefi and qemu_update testing, but it did not document its arguments or defaults. Add a usage header and a --help option that describe the ARCH, PARALLEL and TEST parameters so that developers can discover how to invoke the script and what behavior to expect without having to read through the implementation. Signed-off-by: Li Zhijian --- run_local_tests.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/run_local_tests.sh b/run_local_tests.sh index f1bff2cfe3d..d5e2fc72198 100755 --- a/run_local_tests.sh +++ b/run_local_tests.sh @@ -11,6 +11,18 @@ # The devcontainer tests will be skipped since these require a valid commit ref in # the upstream scripts repo. # +# Usage: +# ./run_local_tests.sh [ARCH] [PARALLEL] [TEST ...] +# +# ARCH : Machine architecture to test (default: amd64) +# PARALLEL : Number of parallel tests (default: 2) +# TEST ... : Optional list of kola tests/globs to run. If omitted, +# all suitable qemu_uefi tests (except devcontainer) are run +# and qemu_update tests are executed as well. +# +# Helper options: +# -h, --help : Show this help and exit. +# # Requirements: # - Docker (for running the Mantle container). # @@ -63,6 +75,21 @@ EOF } #-- +function usage() { + cat < Date: Mon, 18 May 2026 17:45:45 +0800 Subject: [PATCH 3/6] ci-automation: add list-tests helper to run_local_tests.sh When working with the mantle image it is useful to inspect the set of available kola tests before running any local qemu_uefi or qemu_update runs, but run_local_tests.sh did not provide a way to query them. Add a --list-tests helper option that runs kola list --platform qemu in the configured mantle container and prints the result without starting any tests, allowing developers to quickly discover the test set from the same script they use to run local suites. Signed-off-by: Li Zhijian --- run_local_tests.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/run_local_tests.sh b/run_local_tests.sh index d5e2fc72198..30eeffb00e7 100755 --- a/run_local_tests.sh +++ b/run_local_tests.sh @@ -20,8 +20,11 @@ # all suitable qemu_uefi tests (except devcontainer) are run # and qemu_update tests are executed as well. # +# # Helper options: # -h, --help : Show this help and exit. +# --list-tests : List all qemu/qemu_update tests that would be run by +# default (excluding devcontainer tests) and exit. # # Requirements: # - Docker (for running the Mantle container). @@ -86,6 +89,8 @@ Usage: ./run_local_tests.sh [ARCH] [PARALLEL] [TEST ...] and qemu_update tests are executed as well. Helper options: -h, --help : Show this help and exit. + --list-tests : List all qemu/qemu_update tests that would be run by + default (excluding devcontainer tests) and exit. EOF } #-- @@ -147,10 +152,18 @@ function run_local_tests() ( if [[ "$(basename "${0}")" = "run_local_tests.sh" ]] ; then set -euo pipefail - if [[ $# -gt 0 ]] && [[ "$1" = "-h" || "$1" = "--help" ]]; then - usage - exit 0 - fi + case "${1:-}" in + -h|--help) + usage + exit 0 + ;; + --list-tests) + # List all tests that would be run by default and exit. + mantle_container="$(cat "sdk_container/.repo/manifests/mantle-container")" + docker run "${mantle_container}" kola list --platform qemu + exit 0 + ;; + esac run_local_tests "${@}" fi From 40c1b70c61da68658a32f852bde203a2cd1b43e6 Mon Sep 17 00:00:00 2001 From: Li Zhijian Date: Tue, 19 May 2026 15:15:47 +0800 Subject: [PATCH 4/6] ci-automation: stop on empty test output Stop the retry flow when the vendor test runner does not produce a TAP file. This avoids handing an empty result to test_update_reruns.sh and makes the underlying failure visible earlier in the log. After this patch, when it failed to download the qemu image: $ ./run_local_tests.sh amd64 2 docker.base ================================= Using Mantle docker image 'ghcr.io/flatcar/mantle:git-ca80a2eaee4cc195ae6e17f9202c1d72e729d460' ================================= Running qemu_uefi tests git-ca80a2eaee4cc195ae6e17f9202c1d72e729d460: Pulling from flatcar/mantle Digest: sha256:cd37c1ba21b8051eb2632e171d4f1f9bc7e91708883575343265d3d58940d5df Status: Image is up to date for ghcr.io/flatcar/mantle:git-ca80a2eaee4cc195ae6e17f9202c1d72e729d460 zstd could not be found. unpacking container image may fail. ++++ Running qemu_uefi.sh inside __TESTS__/qemu_uefi ++++ ++++ qemu_uefi.sh: downloading /work/__build__/images/images/amd64-usr/latest/flatcar_production_image.bin for 4593.2.0+4-gbc1fd0010d (amd64) ++++ curl: (22) The requested URL returned error: 404 image_escaped: qemu_uefi.sh return 22, __TESTS__/qemu_uefi/results-run-1.tap ERROR: something went wrong, result is empty: __TESTS__/qemu_uefi/results-run-1.tap ########### All re-runs exhausted (5). Giving up. ########### Signed-off-by: Li Zhijian --- ci-automation/test.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ci-automation/test.sh b/ci-automation/test.sh index f497ddcac6c..e5a4a6ad39b 100644 --- a/ci-automation/test.sh +++ b/ci-automation/test.sh @@ -157,6 +157,8 @@ function _test_run_impl() { local tests_escaped=() __escape_multiple tests_escaped "${@}" + # Remove the old results first + rm -f ${tests_dir}/*-run-1.* || true # Vendor tests may need to know if it is a first run or a rerun touch "${work_dir}/first_run" for retry in $(seq "${retries}"); do @@ -176,6 +178,11 @@ function _test_run_impl() { set -e rm -f "${work_dir}/first_run" + [[ -s "${tests_dir}/${tapfile}" ]] || { + echo "ERROR: something went wrong, result is empty: ${tests_dir}/${tapfile}" + break + } + # Note: git safe.directory is not set in this run as it does not use git docker run --pull always --rm --name="${container_name}" --privileged --net host -v /dev:/dev \ -w /work -v "$PWD":/work "${MANTLE_REF}" \ From 537dc4f11a249195f3849cb763f7a8f023e28479 Mon Sep 17 00:00:00 2001 From: Li Zhijian Date: Tue, 19 May 2026 15:42:53 +0800 Subject: [PATCH 5/6] ci-automation: stop forcing pulls for test reruns Drop --pull always when starting the rerun helper container. The rerun path should reuse the configured image instead of unconditionally refreshing it from the registry. This avoids unnecessary network pulls and keeps reruns predictable. Signed-off-by: Li Zhijian --- ci-automation/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-automation/test.sh b/ci-automation/test.sh index e5a4a6ad39b..8a1f60ced6f 100644 --- a/ci-automation/test.sh +++ b/ci-automation/test.sh @@ -184,7 +184,7 @@ function _test_run_impl() { } # Note: git safe.directory is not set in this run as it does not use git - docker run --pull always --rm --name="${container_name}" --privileged --net host -v /dev:/dev \ + docker run --rm --name="${container_name}" --privileged --net host -v /dev:/dev \ -w /work -v "$PWD":/work "${MANTLE_REF}" \ ci-automation/test_update_reruns.sh \ "${arch}" "${vernum}" "${image}" "${retry}" \ From 534d92cb67cd00b66dbccf6b5cbd1ad03ede9b7f Mon Sep 17 00:00:00 2001 From: Li Zhijian Date: Thu, 21 May 2026 16:00:29 +0800 Subject: [PATCH 6/6] ci-automation: Remove unnecessary zstd prerequisite check When running `./run_local_tests.sh`, a warning is printed if `zstd` is not found in the host environment: $ ./run_local_tests.sh arm64 2 cl.cloudinit.script ... zstd could not be found. unpacking container image may fail. ... This check is performed because `ci-config.env` is sourced by the script. However, the `run_local_tests.sh` workflow itself does not depend on `zstd`. The `zstd` command is required for building Flatcar[1], but that process runs inside the Flatcar SDK container, which is guaranteed to have `zstd` installed. The check on the host running the local tests is therefore redundant and produces confusing noise for developers. This patch removes the check to eliminate the spurious warning. [1] https://github.com/flatcar/mantle/pull/853#issuecomment-4499690038 Signed-off-by: Li Zhijian --- ci-automation/ci-config.env | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ci-automation/ci-config.env b/ci-automation/ci-config.env index f54c7d2cda8..287dc0b0660 100644 --- a/ci-automation/ci-config.env +++ b/ci-automation/ci-config.env @@ -19,11 +19,6 @@ GC_BUCKET="flatcar-linux" DEFAULT_HTTP_IMAGE_URL_TEMPLATE="@PROTO@://${BUILDCACHE_SERVER}/images/@ARCH@/@VERNUM@" -if ! command -v zstd > /dev/null; then - # we require zstd and it is included by default on flatcar - echo >&2 "zstd could not be found. unpacking container image may fail." -fi - CI_GIT_AUTHOR="flatcar-ci" CI_GIT_EMAIL="infra+ci@flatcar-linux.org"