You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by da...@apache.org on 2024/09/06 21:05:36 UTC

(kafka) branch gh-fix-junit-timeout created (now 173da2fdee2)

This is an automated email from the ASF dual-hosted git repository.

davidarthur pushed a change to branch gh-fix-junit-timeout
in repository https://gitbox.apache.org/repos/asf/kafka.git


      at 173da2fdee2 Fail the whole pipeline if junit step times out.

This branch includes the following new commits:

     new 173da2fdee2 Fail the whole pipeline if junit step times out.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(kafka) 01/01: Fail the whole pipeline if junit step times out.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidarthur pushed a commit to branch gh-fix-junit-timeout
in repository https://gitbox.apache.org/repos/asf/kafka.git

commit 173da2fdee2e9d8e50f8d3f2df40b814d7bf03df
Author: David Arthur <mu...@gmail.com>
AuthorDate: Fri Sep 6 17:04:53 2024 -0400

    Fail the whole pipeline if junit step times out.
---
 .github/scripts/junit.py    | 16 ++++++++++++++--
 .github/workflows/build.yml |  7 ++++---
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/.github/scripts/junit.py b/.github/scripts/junit.py
index 1850c0c2e8a..bb6dc33cbfb 100644
--- a/.github/scripts/junit.py
+++ b/.github/scripts/junit.py
@@ -144,7 +144,10 @@ if __name__ == "__main__":
                         required=False,
                         default="build/junit-xml/**/*.xml",
                         help="Path to XML files. Glob patterns are supported.")
-
+    parser.add_argument("--done-file",
+                        required=False,
+                        default="",
+                        help="A file that signals the test suite was completed")
     if not os.getenv("GITHUB_WORKSPACE"):
         print("This script is intended to by run by GitHub Actions.")
         exit(1)
@@ -153,7 +156,7 @@ if __name__ == "__main__":
 
     reports = glob(pathname=args.path, recursive=True)
     logger.debug(f"Found {len(reports)} JUnit results")
-    workspace_path = get_env("GITHUB_WORKSPACE") # e.g., /home/runner/work/apache/kafka
+    workspace_path = get_env("GITHUB_WORKSPACE")  # e.g., /home/runner/work/apache/kafka
 
     total_file_count = 0
     total_run = 0       # All test runs according to <testsuite tests="N"/>
@@ -248,6 +251,15 @@ if __name__ == "__main__":
             print(f"| {row_joined} |")
         print("\n</details>")
 
+
+    # Print special message if these are partial results
+    if args.done_file:
+        if not os.path.exists(args.done_file):
+            logger.debug(f"Did not find done file '{args.done_file}'. These are partial results!")
+            logger.debug(summary)
+            logger.debug("Failing this step because done file was missing.")
+            exit(1)
+
     logger.debug(summary)
     if total_failures > 0:
         logger.debug(f"Failing this step due to {total_failures} test failures")
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index d6da2a94fa5..fcb2ae4975b 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -107,17 +107,19 @@ jobs:
         # --scan:         Attempt to publish build scans in PRs. This will only work on PRs from apache/kafka, not public forks.
         # --continue:     Keep running even if a test fails
         # -PcommitId      Prevent the Git SHA being written into the jar files (which breaks caching)
+        id: junit-tests
         timeout-minutes: 180  # 3 hours
         continue-on-error: true
         run: |
+          rm build/junit-xml/done
           ./gradlew --build-cache --scan --continue \
           -PtestLoggingEvents=started,passed,skipped,failed \
           -PmaxParallelForks=2 \
           -PmaxTestRetries=1 -PmaxTestRetryFailures=10 \
           -PcommitId=xxxxxxxxxxxxxxxx \
           test
+          touch build/junit-xml/done
       - name: Archive JUnit reports
-        if: always()
         uses: actions/upload-artifact@v4
         id: junit-upload-artifact
         with:
@@ -126,8 +128,7 @@ jobs:
             **/build/reports/tests/test/*
           if-no-files-found: ignore
       - name: Parse JUnit tests
-        if: always()
-        run: python .github/scripts/junit.py >> $GITHUB_STEP_SUMMARY
+        run: python .github/scripts/junit.py --done-file build/junit-xml/done >> $GITHUB_STEP_SUMMARY
         env:
           GITHUB_WORKSPACE: ${{ github.workspace }}
           REPORT_URL: ${{ steps.junit-upload-artifact.outputs.artifact-url }}