database: Allow filtering out new failures.

* src/cuirass/database.scm (db-get-builds): Add support for
‘new-failure’.
(db-get-builds-min, db-get-builds-max): Add support for ‘newly-failed’.
This commit is contained in:
Ludovic Courtès 2023-11-18 19:01:25 +01:00
parent 9fdfd27c4f
commit 1c2e4f0f70
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 9 additions and 1 deletions

View File

@ -1449,7 +1449,11 @@ CASE WHEN CAST(:borderlowid AS integer) IS NULL THEN
. ,(match (assq-ref filters 'weather)
(#f #f)
('all "Builds.weather >= 0")
('new "(Builds.weather = 0 OR Builds.weather = 1)")))
('new "(Builds.weather = 0 OR Builds.weather = 1)")
('new-failure
(string-append
"Builds.weather = "
(number->string (build-weather new-failure))))))
(border-low-time
. "(((:borderlowtime, :borderlowid) < (Builds.stoptime, Builds.id))
OR :borderlowtime IS NULL OR :borderlowid IS NULL)")
@ -1995,6 +1999,8 @@ WHERE evaluation = " eval " AND
((" status " = 'pending' AND Builds.status < 0) OR
(" status " = 'succeeded' AND Builds.status = 0) OR
(" status " = 'failed' AND Builds.status > 0) OR
(" status " = 'newly-failed' AND Builds.status = " (build-status failed) "
AND Builds.weather = " (build-weather new-failure) ") OR
" status "::text IS NULL)
ORDER BY stoptime ASC, id ASC
LIMIT 1"))
@ -2012,6 +2018,8 @@ WHERE evaluation = " eval " AND
((" status " = 'pending' AND Builds.status < 0) OR
(" status " = 'succeeded' AND Builds.status = 0) OR
(" status " = 'failed' AND Builds.status > 0) OR
(" status " = 'newly-failed' AND Builds.status = " (build-status failed) "
AND Builds.weather = " (build-weather new-failure) ") OR
" status "::text IS NULL)
ORDER BY stoptime DESC, id DESC
LIMIT 1"))