From 905b8af1f9e5d9bee25aee880299239a0d37cb4a 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 ... fatal: not a git repository: ../flatcar/scripts/.git/worktrees/... ... Commit 87e13eb3debc ("ci-automation: Allow git to work on directory owned by other user") added "git config --global --add safe.directory /work" to the test docker invocation to fix an issue where get_git_channel() failed inside the mantle container, which caused AWS publishing to skip the Alpha channel. However, this git config was never necessary for the test path. In _test_run_impl(), both get_git_version() and get_git_channel() are called on the host side before the docker run, and their outputs are stored as files for the container to consume. Since commit 1d6f38a72e ("ci-automation: Reduce boilerplate in vendor tests"), all vendor testing scripts read git version and channel from these precomputed files via vendor_test.sh rather than running git commands. No vendor script (qemu_uefi, qemu, qemu_update, aws, azure, gce, etc.) executes git inside the mantle container. The git config in the test docker invocation was therefore redundant from the start. Remove it to avoid failures in worktree-based local test setups, while CI behavior remains unchanged since the non-worktree case is unaffected. 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 5ae644538f71cb8a8b5a397442dda90f083c151e 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 e4ee0c8a08a..e640ecfb030 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 all qemu/qemu_update tests. Signed-off-by: Li Zhijian --- run_local_tests.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/run_local_tests.sh b/run_local_tests.sh index e640ecfb030..6cb6f5283b5 100755 --- a/run_local_tests.sh +++ b/run_local_tests.sh @@ -20,8 +20,10 @@ # 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 and exit. # # Requirements: # - Docker (for running the Mantle container). @@ -86,6 +88,7 @@ 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 and exit. EOF } #-- @@ -147,10 +150,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 qemu/qemu_update tests and exit. + mantle_container="$(cat "sdk_container/.repo/manifests/mantle-container")" + docker run --rm "${mantle_container}" kola list --platform qemu + exit 0 + ;; + esac run_local_tests "${@}" fi From ece8fe18b171d4739f245be62b7f52e1f4e3c8bc 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..a5c6c250fc9 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}"/results-run-1.tap "${tests_dir}"/failed-run-1.txt # 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 0335356eb048a7692c8f1c47f7387ef4c256ea11 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: revert "Always pull mantle image when running tests" This reverts the --pull always addition from commit 60a45ef0c5 ("ci-automation/test: Always pull mantle image when running tests"). MANTLE_REF points to an immutable tag (ghcr.io/flatcar/mantle:git-) rather than a mutable tag like :latest, so --pull always only adds an unnecessary registry lookup without any functional effect. Removing it avoids pointless network round-trips and ensures reruns use the same local image for consistent results. Signed-off-by: Li Zhijian --- ci-automation/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-automation/test.sh b/ci-automation/test.sh index a5c6c250fc9..428f51d9103 100644 --- a/ci-automation/test.sh +++ b/ci-automation/test.sh @@ -171,7 +171,7 @@ function _test_run_impl() { # determine success based on test results (tapfile). set +e touch sdk_container/.env - 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}" \ bash -c "source sdk_container/.env && \ ci-automation/vendor-testing/${image_escaped}.sh ${common_test_args_escaped[*]} ${tapfile_escaped} ${tests_escaped[*]}" @@ -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 8064deffcf7f58166f7fc280235afbe2558c925a 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"