Only show successful builds on the front page

Failed builds can be viewed on the linked /failed-builds/ page.
This commit is contained in:
Robur 2021-11-17 16:00:58 +00:00
parent e1d950ad5b
commit 2e82778e87
4 changed files with 6 additions and 5 deletions

View file

@ -391,7 +391,7 @@ module Build = struct
LIMIT 1
|}
let get_latest =
let get_latest_successful_with_binary =
Caqti_request.find_opt
Caqti_type.(tup2 (id `job) string)
Caqti_type.(tup3
@ -406,7 +406,7 @@ module Build = struct
FROM build b
LEFT JOIN build_artifact a ON
b.main_binary = a.id
WHERE b.job = ?1 AND b.platform = ?2
WHERE b.job = ?1 AND b.platform = ?2 AND b.result_code = 0
ORDER BY b.start_d DESC, b.start_ps DESC
LIMIT 1
|}

View file

@ -121,7 +121,7 @@ sig
([`job] id, Cstruct.t, [ `Many | `One | `Zero ]) Caqti_request.t
val get_all_artifact_sha_by_platform :
([`job] id * string, Cstruct.t, [ `Many | `One | `Zero ]) Caqti_request.t
val get_latest :
val get_latest_successful_with_binary :
([`job] id * string, [`build] id * t * file option, [< `Many | `One | `Zero > `One `Zero ])
Caqti_request.t
val get_latest_failed :

View file

@ -58,7 +58,7 @@ let build uuid (module Db : CONN) =
not_found
let build_with_main_binary job platform (module Db : CONN) =
Db.find_opt Builder_db.Build.get_latest (job, platform) >|=
Db.find_opt Builder_db.Build.get_latest_successful_with_binary (job, platform) >|=
Option.map (fun (_id, build, file) -> (build, file))
let build_hash hash (module Db : CONN) =

View file

@ -509,7 +509,8 @@ let compare_builds job_left job_right
let failed_builds ~start ~count builds =
let build (job_name, build) =
li [
txtf "%s %a " job_name pp_platform (Some build.Builder_db.Build.platform);
check_icon build.Builder_db.Build.result;
txtf " %s %a " job_name pp_platform (Some build.platform);
a ~a:[Fmt.kstr a_href "/job/%s/build/%a/" job_name Uuidm.pp build.uuid]
[txtf "%a" pp_ptime build.start];
txtf " %a" Builder.pp_execution_result build.result;