guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]


From: Ludovic Courtès
Date: Wed, 22 Nov 2023 05:12:26 -0500 (EST)

branch: master
commit 66167c1a29d41495d380e9e07609a8ae04a38f35
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed Nov 22 10:47:36 2023 +0100

    database: Add ‘newly-failed’ field to <build-summary>.
    
    * src/cuirass/database.scm (<build-summary>)[newly-failed]: New field.
    (db-get-evaluations-build-summary): Set it.
    * tests/database.scm ("db-get-evaluations-build-summary"): Test it.
---
 src/cuirass/database.scm | 10 ++++++++--
 tests/database.scm       |  3 ++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm
index d3dc478..a93bf85 100644
--- a/src/cuirass/database.scm
+++ b/src/cuirass/database.scm
@@ -115,6 +115,7 @@
             build-summary-checkouts
             build-summary-succeeded
             build-summary-failed
+            build-summary-newly-failed
             build-summary-scheduled
 
             evaluation-summary?
@@ -1737,6 +1738,7 @@ ORDER BY id DESC LIMIT :limit;")
                            (build-summary-evaluation-id this-build-summary))))
   (succeeded     build-summary-succeeded)
   (failed        build-summary-failed)
+  (newly-failed  build-summary-newly-failed)
   (scheduled     build-summary-scheduled))
 
 (define (db-get-evaluations-build-summary spec limit border-low border-high)
@@ -1745,7 +1747,10 @@ ORDER BY id DESC LIMIT :limit;")
 SELECT E.id, E.status,
 SUM(CASE WHEN B.status = 0 THEN 1 ELSE 0 END) as succeeded,
 SUM(CASE WHEN B.status > 0 THEN 1 ELSE 0 END) as failed,
-SUM(CASE WHEN B.status < 0 THEN 1 ELSE 0 END) as scheduled FROM
+SUM(CASE WHEN B.status < 0 THEN 1 ELSE 0 END) as scheduled,
+SUM(CASE WHEN (B.status > 0 AND B.weather = " (build-weather new-failure) ")\
+    THEN 1 ELSE 0 END) as newfailures
+FROM
 (SELECT id, status FROM Evaluations
  WHERE specification = " spec "
 AND (id > " border-low " OR " border-low "::text IS NULL)
@@ -1760,7 +1765,7 @@ ORDER BY E.id DESC;"))
       (match rows
         (()
          (reverse summaries))
-        (((id status succeeded failed scheduled) . rest)
+        (((id status succeeded failed scheduled newly-failed) . rest)
          (loop rest
                (cons (build-summary
                       (evaluation-id (string->number id))
@@ -1768,6 +1773,7 @@ ORDER BY E.id DESC;"))
                       (checkouts (db-get-checkouts id))
                       (succeeded (or (string->number succeeded) 0))
                       (failed (or (string->number failed) 0))
+                      (newly-failed (or (string->number newly-failed) 0))
                       (scheduled (or (string->number scheduled) 0)))
                      summaries)))))))
 
diff --git a/tests/database.scm b/tests/database.scm
index 3a1cd55..0920172 100644
--- a/tests/database.scm
+++ b/tests/database.scm
@@ -414,13 +414,14 @@ timestamp, checkouttime, evaltime) VALUES ('guix', 0, 0, 
0, 0);")
            (db-get-evaluations 2))))
 
   (test-equal "db-get-evaluations-build-summary"
-    '((0 0 0) (0 0 0) (0 1 1))
+    '((0 0 0 0) (0 0 0 0) (0 1 0 1))
     (with-fibers
       (let ((summaries
              (db-get-evaluations-build-summary "guix" 3 #f #f)))
         (map (lambda (summary)
                (list (build-summary-succeeded summary)
                      (build-summary-failed summary)
+                     (build-summary-newly-failed summary)
                      (build-summary-scheduled summary)))
              summaries))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]