]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Replace check_for_junit_xml anchor with a Python script
authorŠtěpán Balážik <stepan@isc.org>
Wed, 15 Oct 2025 16:26:48 +0000 (18:26 +0200)
committerŠtěpán Balážik <stepan@isc.org>
Wed, 7 Jan 2026 16:29:53 +0000 (17:29 +0100)
This allows checking of multiple files with variable filenames rather
than insisting on harcoded `junit.xml`.

(cherry picked from commit abecddb13afa3f8ad9611f1241a635fbe6b90818)

.gitlab-ci.yml

index ac3e755183f96a4ec3372d728b3c337bb76cfb1e..0d7ad2da1fbf3a8a9d2408d8a2cf39d6703c71c1 100644 (file)
@@ -440,21 +440,6 @@ stages:
         fi
       fi
 
-.check_for_junit_xml: &check_for_junit_xml
-    # test if junit.xml file exists and is longer 40 bytes
-    # (i.e., contains more than `<testsuites><testsuite /></testsuites>`)
-    - if [ -f "$CI_PROJECT_DIR"/junit.xml ]; then
-        if [ $(wc -c < "$CI_PROJECT_DIR"/junit.xml) -gt 40 ]; then
-          echo "junit.xml file exists and is longer than 40 bytes.";
-        else
-          echo "junit.xml file exists but is too short.";
-          exit 1;
-        fi
-      else
-        echo "junit.xml file does not exist.";
-        exit 1;
-      fi
-
 .build: &build_job
   <<: *default_triggering_rules
   stage: build
@@ -570,7 +555,9 @@ stages:
     - if pytest --version | grep -F "pytest 9.0" >/dev/null; then echo "filterwarnings = ignore::pytest.PytestRemovedIn9Warning" >> pytest.ini; fi
     - >
       ("$PYTEST" --junit-xml="$CI_PROJECT_DIR"/junit.xml -n "$TEST_PARALLEL_JOBS" | tee pytest.out.txt) || RET=1
-    - *check_for_junit_xml
+    - git clone --depth 1 https://gitlab.isc.org/isc-projects/bind9-qa.git
+    - >
+      "$PYTHON" bind9-qa/ci/postprocess_junit_files.py "$CI_PROJECT_DIR"/junit.xml --output "$CI_PROJECT_DIR"/junit.xml
     - (exit $RET)
     - '( ! grep -F "grep: warning:" pytest.out.txt )'
     - test "$CLEAN_BUILD_ARTIFACTS_ON_SUCCESS" -eq 0 || ( cd ../../.. && make clean >/dev/null 2>&1 )
@@ -605,7 +592,9 @@ stages:
     - *find_python
     - >
       "$PYTHON" bin/tests/convert-trs-to-junit.py . > "$CI_PROJECT_DIR"/junit.xml
-    - *check_for_junit_xml
+    - *git_clone_bind9-qa
+    - >
+      "$PYTHON" bind9-qa/ci/postprocess_junit_files.py "$CI_PROJECT_DIR"/junit.xml --output "$CI_PROJECT_DIR"/junit.xml
     - (exit $RET)
   after_script:
     - cat bin/tests/system/test-suite.log || true
@@ -632,9 +621,11 @@ stages:
     - RET=0
     - make -j${TEST_PARALLEL_JOBS:-1} -k unit V=1 || RET=$?
     - *find_python
+    - *git_clone_bind9-qa
     - >
       "$PYTHON" "$CI_PROJECT_DIR"/bin/tests/convert-trs-to-junit.py . > "$CI_PROJECT_DIR"/junit.xml
-    - *check_for_junit_xml
+    - >
+      "$PYTHON" bind9-qa/ci/postprocess_junit_files.py "$CI_PROJECT_DIR"/junit.xml --output "$CI_PROJECT_DIR"/junit.xml
     - (exit $RET)
     - test "$CLEAN_BUILD_ARTIFACTS_ON_SUCCESS" -eq 0 || make clean >/dev/null 2>&1
   artifacts:
@@ -957,12 +948,13 @@ cross-version-config-tests:
     - *configure
     - *setup_interfaces
     - make -j${BUILD_PARALLEL_JOBS:-1}
+    - *find_python
+    - *find_pytest
     - git clone --branch "${BIND_BASELINE_VERSION}" --depth 1 https://gitlab.isc.org/isc-projects/bind9.git "bind-${BIND_BASELINE_VERSION}"
     - cd "bind-${BIND_BASELINE_VERSION}"
     - autoreconf -fi
     - *configure
     - make -j${BUILD_PARALLEL_JOBS:-1}
-    - *find_pytest
     # The cross-version-config-tests job would fail when a system test is
     # removed from the upcoming release. To avoid this, remove the system test
     # also from the $BIND_BASELINE_VERSION.
@@ -985,7 +977,9 @@ cross-version-config-tests:
     - RET=0
     - >
       "$PYTEST" --setup-only --junit-xml="$CI_PROJECT_DIR"/junit.xml -n "${TEST_PARALLEL_JOBS:-1}" || RET=1
-    - *check_for_junit_xml
+    - *git_clone_bind9-qa
+    - >
+      "$PYTHON" bind9-qa/ci/postprocess_junit_files.py "$CI_PROJECT_DIR"/junit.xml --output "$CI_PROJECT_DIR"/junit.xml
     - (exit $RET)
   needs:
     - job: autoreconf