From 0d4c8a235a16f113c0b91712f79e1295cbb9bcbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Mon, 7 Oct 2024 08:45:43 +0200 Subject: [PATCH 1/4] CI: add testlog.txt as build artifacts That way we will be able to check the logs in the case of failure. --- .gitlab-ci.yml | 12 +++++++----- .gitlab-ci/ci.template | 2 ++ .gitlab-ci/run-test.sh | 22 +++++++++++++++++----- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 879589c2a..705b86382 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -60,11 +60,11 @@ variables: # # This is done by running `ci-fairy generate-template` and possibly bumping # ".default_tag". - ALPINE_TAG: 'tag-759073a4a7c5' - CENTOS_TAG: 'tag-8e3ebf909439' - DEBIAN_TAG: 'tag-529c288644bc' - FEDORA_TAG: 'tag-8e3ebf909439' - UBUNTU_TAG: 'tag-529c288644bc' + ALPINE_TAG: 'tag-b7175d703ab5' + CENTOS_TAG: 'tag-60c52d9ef928' + DEBIAN_TAG: 'tag-5b0be38a2514' + FEDORA_TAG: 'tag-60c52d9ef928' + UBUNTU_TAG: 'tag-5b0be38a2514' ALPINE_EXEC: 'bash .gitlab-ci/alpine-install.sh' CENTOS_EXEC: 'bash .gitlab-ci/fedora-install.sh' @@ -83,6 +83,7 @@ variables: - NetworkManager-1*.tar.xz - NetworkManager-1*.src.rpm - nm-test.log + - testlog.txt .nm_artifacts_debug: artifacts: @@ -90,6 +91,7 @@ variables: when: always paths: - nm-test.log + - testlog.txt ################################################################# # # diff --git a/.gitlab-ci/ci.template b/.gitlab-ci/ci.template index e7a7c0e55..ef853ca1d 100644 --- a/.gitlab-ci/ci.template +++ b/.gitlab-ci/ci.template @@ -88,6 +88,7 @@ variables: - NetworkManager-1*.tar.xz - NetworkManager-1*.src.rpm - nm-test.log + - testlog.txt .nm_artifacts_debug: artifacts: @@ -95,6 +96,7 @@ variables: when: always paths: - nm-test.log + - testlog.txt ################################################################# # # diff --git a/.gitlab-ci/run-test.sh b/.gitlab-ci/run-test.sh index 2ae72f28e..66cd6d237 100755 --- a/.gitlab-ci/run-test.sh +++ b/.gitlab-ci/run-test.sh @@ -106,22 +106,34 @@ check_run_clean() { return 0 } +die_with_testlog() { + mv ./build/meson-logs/testlog.txt ./testlog.txt + exit 1 +} + if check_run_clean meson+gcc+docs+valgrind ; then - CC=gcc WITH_DOCS=1 WITH_VALGRIND=1 contrib/scripts/nm-ci-run.sh + CC=gcc WITH_DOCS=1 WITH_VALGRIND=1 contrib/scripts/nm-ci-run.sh || die_with_testlog mv INST/share/gtk-doc/html "$ARTIFACT_DIR/docs-html" fi -check_run_clean meson+clang && CC=clang WITH_DOCS=0 contrib/scripts/nm-ci-run.sh -check_run_clean rpm+meson && test $IS_FEDORA = 1 && ./contrib/fedora/rpm/build_clean.sh -g -w crypto_gnutls -w debug -w iwd -w test -w meson +if check_run_clean meson+clang; then + CC=clang WITH_DOCS=0 contrib/scripts/nm-ci-run.sh || die_with_testlog +fi + +if check_run_clean rpm+meson; then + test $IS_FEDORA = 1 && ./contrib/fedora/rpm/build_clean.sh -g -w crypto_gnutls -w debug -w iwd -w test -w meson || die_with_testlog +fi if check_run_clean tarball && [ "$NM_BUILD_TARBALL" = 1 ]; then - SIGN_SOURCE=0 ./contrib/fedora/rpm/build_clean.sh -r + SIGN_SOURCE=0 ./contrib/fedora/rpm/build_clean.sh -r || die_with_testlog mv ./build/meson-dist/NetworkManager-1*.tar.xz "$ARTIFACT_DIR/" mv ./contrib/fedora/rpm/latest/SRPMS/NetworkManager-1*.src.rpm "$ARTIFACT_DIR/" do_clean fi -check_run_clean tarball+meson && CC=gcc WITH_DOCS=1 CONFIGURE_ONLY=1 contrib/scripts/nm-ci-run.sh +if check_run_clean tarball+meson; then + CC=gcc WITH_DOCS=1 CONFIGURE_ONLY=1 contrib/scripts/nm-ci-run.sh || die_with_testlog +fi ############################################################################### From 7cef59c5038dd720b0aabc35cb667397dad7debe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Mon, 7 Oct 2024 11:21:31 +0200 Subject: [PATCH 2/4] ci: rename function in run-test.sh for clarity I always struggle to understand what 'check_run' means, as it suggests that the run is executed and the results checked. What it acutally does is to check if the run passed as argument is selected. Rename to is_run_selected. Also, remove check_run_clean which was only a check_run + do_clean. Just call directly to do_clean. --- .gitlab-ci/run-test.sh | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/.gitlab-ci/run-test.sh b/.gitlab-ci/run-test.sh index 66cd6d237..b84d677e9 100755 --- a/.gitlab-ci/run-test.sh +++ b/.gitlab-ci/run-test.sh @@ -50,7 +50,7 @@ meson --version export NMTST_SKIP_CHECK_GITLAB_CI=1 # Assert that "$1" is one of the valid values for NM_TEST_SELECT_RUN. die() otherwise. -check_run_assert() { +is_run_selected_assert() { { set +x; } 2>/dev/null local run="$1" local a @@ -83,27 +83,19 @@ check_run_assert() { } [ -z "$NM_TEST_SELECT_RUN" ] && NM_TEST_SELECT_RUN=all -check_run_assert "$NM_TEST_SELECT_RUN" +is_run_selected_assert "$NM_TEST_SELECT_RUN" -check_run() { - local test_no="$1" +is_run_selected() { + local run="$1" - check_run_assert "$test_no" + is_run_selected_assert "$run" # Usually, we run the build several times. However, for testing # the build script manually, it can be useful to explicitly select # one step to run. For example, if step 3 is known to fail, you # can still manually run step A by setting NM_TEST_SELECT_RUN=A. - test "$NM_TEST_SELECT_RUN" = all -o "$NM_TEST_SELECT_RUN" = "$test_no" -} - -check_run_clean() { - if ! check_run "$1" ; then - return 1 - fi - do_clean - return 0 + test "$NM_TEST_SELECT_RUN" = all -o "$NM_TEST_SELECT_RUN" = "$run" } die_with_testlog() { @@ -111,27 +103,32 @@ die_with_testlog() { exit 1 } -if check_run_clean meson+gcc+docs+valgrind ; then +if is_run_selected meson+gcc+docs+valgrind ; then + do_clean CC=gcc WITH_DOCS=1 WITH_VALGRIND=1 contrib/scripts/nm-ci-run.sh || die_with_testlog mv INST/share/gtk-doc/html "$ARTIFACT_DIR/docs-html" fi -if check_run_clean meson+clang; then +if is_run_selected meson+clang; then + do_clean CC=clang WITH_DOCS=0 contrib/scripts/nm-ci-run.sh || die_with_testlog fi -if check_run_clean rpm+meson; then +if is_run_selected rpm+meson; then + do_clean test $IS_FEDORA = 1 && ./contrib/fedora/rpm/build_clean.sh -g -w crypto_gnutls -w debug -w iwd -w test -w meson || die_with_testlog fi -if check_run_clean tarball && [ "$NM_BUILD_TARBALL" = 1 ]; then +if is_run_selected tarball && [ "$NM_BUILD_TARBALL" = 1 ]; then + do_clean SIGN_SOURCE=0 ./contrib/fedora/rpm/build_clean.sh -r || die_with_testlog mv ./build/meson-dist/NetworkManager-1*.tar.xz "$ARTIFACT_DIR/" mv ./contrib/fedora/rpm/latest/SRPMS/NetworkManager-1*.src.rpm "$ARTIFACT_DIR/" do_clean fi -if check_run_clean tarball+meson; then +if is_run_selected tarball+meson; then + do_clean CC=gcc WITH_DOCS=1 CONFIGURE_ONLY=1 contrib/scripts/nm-ci-run.sh || die_with_testlog fi @@ -160,7 +157,8 @@ test_subtree() { popd } -if check_run_clean subtree; then +if is_run_selected subtree; then + do_clean for d in c-list c-rbtree c-siphash c-stdaux n-acd n-dhcp4 ; do for cc in gcc clang; do test_subtree "$d" "$cc" @@ -172,10 +170,10 @@ fi if [ "$NM_BUILD_TARBALL" = 1 ]; then do_clean - if check_run meson+gcc+docs+valgrind ; then + if is_run_selected meson+gcc+docs+valgrind ; then mv "$ARTIFACT_DIR/docs-html/" ./ fi - if check_run tarball ; then + if is_run_selected tarball ; then mv \ "$ARTIFACT_DIR"/NetworkManager-1*.tar.xz \ "$ARTIFACT_DIR"/NetworkManager-1*.src.rpm \ From 9354fabaa8f344b1ede0d4fdf549ee1da8f2e41e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Thu, 10 Oct 2024 07:53:29 +0200 Subject: [PATCH 3/4] ci: Update ci-templates to a version that support Alpine versions ci-templates only supported alpine:latest, but support for any other version has been introduced. Use it so our Alpine pipelines stop failing. --- .gitlab-ci.yml | 12 ++++++------ .gitlab-ci/ci.template | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 705b86382..6e48e4373 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,7 +14,7 @@ # see https://docs.gitlab.com/ee/ci/yaml/#includefile -.templates_sha: &template_sha 98b1218f146a1ec96d65e3ce0041f9a6ec5cb5e6 +.templates_sha: &template_sha 593a0a5fe35a523a646a7efae5471c9759b8fba3 @@ -60,11 +60,11 @@ variables: # # This is done by running `ci-fairy generate-template` and possibly bumping # ".default_tag". - ALPINE_TAG: 'tag-b7175d703ab5' - CENTOS_TAG: 'tag-60c52d9ef928' - DEBIAN_TAG: 'tag-5b0be38a2514' - FEDORA_TAG: 'tag-60c52d9ef928' - UBUNTU_TAG: 'tag-5b0be38a2514' + ALPINE_TAG: 'tag-4b249f1fd7fc' + CENTOS_TAG: 'tag-58487201dcba' + DEBIAN_TAG: 'tag-288e1002f3ac' + FEDORA_TAG: 'tag-58487201dcba' + UBUNTU_TAG: 'tag-288e1002f3ac' ALPINE_EXEC: 'bash .gitlab-ci/alpine-install.sh' CENTOS_EXEC: 'bash .gitlab-ci/fedora-install.sh' diff --git a/.gitlab-ci/ci.template b/.gitlab-ci/ci.template index ef853ca1d..42d85b9d6 100644 --- a/.gitlab-ci/ci.template +++ b/.gitlab-ci/ci.template @@ -16,7 +16,7 @@ # see https://docs.gitlab.com/ee/ci/yaml/#includefile -.templates_sha: &template_sha 98b1218f146a1ec96d65e3ce0041f9a6ec5cb5e6 +.templates_sha: &template_sha 593a0a5fe35a523a646a7efae5471c9759b8fba3 {# Group distros by their common (name,) tuples.#} {% set distro_groups = [] %} From 9a35007bac85d0ad43a45d9e8e5ebc1d2bab1737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Thu, 10 Oct 2024 08:21:48 +0200 Subject: [PATCH 4/4] ci: allow to manually select the Fedora version for Tier 1 Versions that has branched out from Rawhide but are still not released still have many changes that breaks the CI. As we want the CI to be more stable for Tier 1, which runs for every MR, do not make the switch as soon as Rawhide has branched, but when we choose so. --- .gitlab-ci.yml | 10 +++++----- .gitlab-ci/config.yml | 2 +- .gitlab-ci/distros-info.yml | 3 ++- .gitlab-ci/distros_support.py | 15 +++++++++++++-- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6e48e4373..396cbd3fe 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -60,11 +60,11 @@ variables: # # This is done by running `ci-fairy generate-template` and possibly bumping # ".default_tag". - ALPINE_TAG: 'tag-4b249f1fd7fc' - CENTOS_TAG: 'tag-58487201dcba' - DEBIAN_TAG: 'tag-288e1002f3ac' - FEDORA_TAG: 'tag-58487201dcba' - UBUNTU_TAG: 'tag-288e1002f3ac' + ALPINE_TAG: 'tag-0959c37ef19b' + CENTOS_TAG: 'tag-70ac400f2325' + DEBIAN_TAG: 'tag-c03f6a5793ce' + FEDORA_TAG: 'tag-70ac400f2325' + UBUNTU_TAG: 'tag-c03f6a5793ce' ALPINE_EXEC: 'bash .gitlab-ci/alpine-install.sh' CENTOS_EXEC: 'bash .gitlab-ci/fedora-install.sh' diff --git a/.gitlab-ci/config.yml b/.gitlab-ci/config.yml index 61b229da0..e7b485fcd 100644 --- a/.gitlab-ci/config.yml +++ b/.gitlab-ci/config.yml @@ -72,4 +72,4 @@ distributions: - '3.20' - '3.19' - '3.18' - - '3.17' + - '3.17' \ No newline at end of file diff --git a/.gitlab-ci/distros-info.yml b/.gitlab-ci/distros-info.yml index 6571707f1..831085aca 100644 --- a/.gitlab-ci/distros-info.yml +++ b/.gitlab-ci/distros-info.yml @@ -9,8 +9,9 @@ fedora: support: yes nm: main - version: 41 - support: yes + support: 2025-11-19 nm: 1.50 + tier1-default: yes - version: 40 support: 2025-05-13 nm: 1.46 diff --git a/.gitlab-ci/distros_support.py b/.gitlab-ci/distros_support.py index c979acfe1..b8af791b2 100755 --- a/.gitlab-ci/distros_support.py +++ b/.gitlab-ci/distros_support.py @@ -124,7 +124,20 @@ for distro, versions in distros_info.items(): # Select a Tier1 distro tier1_distro, tier1_version = "", "" + +for fed_ver_info in distros_info["fedora"]: + # We prefer the Fedora version marked as tier1-default + if fed_ver_info.get("tier1-default", False): + for tier in (tier2, tier3): + if fed_ver_info["version"] in tier.get("fedora", []): + tier1_distro = "fedora" + tier1_version = fed_ver_info["version"] + tier["fedora"].remove(fed_ver_info["version"]) + for distro in ci_distros: + if tier1_distro: + break + for tier in (tier2, tier3): if distro in tier: # Exception: we want to use fedora:latest instead of fedora:rawhide because @@ -142,8 +155,6 @@ for distro in ci_distros: if not tier[distro]: del tier[distro] break - if tier1_distro: - break if not tier1_distro or not tier1_version: print("Warn: no suitable distro for Tier 1 found", file=sys.stderr)