add more data to build endpoint
This commit is contained in:
parent
b26d0a28d1
commit
63223b8c46
1 changed files with 25 additions and 11 deletions
|
@ -406,17 +406,31 @@ let routes ~datadir ~cachedir ~configdir ~expired_jobs =
|
||||||
~log:(fun e -> Log.warn (fun m -> m "Error getting job build: %a" pp_error e))
|
~log:(fun e -> Log.warn (fun m -> m "Error getting job build: %a" pp_error e))
|
||||||
>>= fun (build, main_binary, artifacts, same_input_same_output, different_input_same_output, same_input_different_output, latest, next, previous) ->
|
>>= fun (build, main_binary, artifacts, same_input_same_output, different_input_same_output, same_input_different_output, latest, next, previous) ->
|
||||||
let solo5_manifest = Option.bind main_binary (Model.solo5_manifest datadir) in
|
let solo5_manifest = Option.bind main_binary (Model.solo5_manifest datadir) in
|
||||||
Views.Job_build.make
|
match Dream.header req "Accept" with
|
||||||
~job_name
|
| Some accept when String.starts_with ~prefix:"application/json" accept ->
|
||||||
~build
|
let json_response =
|
||||||
~artifacts
|
`Assoc [
|
||||||
~main_binary
|
"job_name", `String job_name;
|
||||||
~solo5_manifest
|
"uuid", `String (Uuidm.to_string build.uuid);
|
||||||
~same_input_same_output
|
"platform", `String build.platform;
|
||||||
~different_input_same_output
|
"build_start_time", `String (Ptime.to_rfc3339 build.start);
|
||||||
~same_input_different_output
|
"build_finish_time", `String (Ptime.to_rfc3339 build.finish);
|
||||||
~latest ~next ~previous
|
"main_binary", (match build.main_binary with Some _ -> `Bool true | None -> `Bool false)
|
||||||
|> string_of_html |> Dream.html |> Lwt_result.ok
|
] |> Yojson.Basic.to_string
|
||||||
|
in
|
||||||
|
Dream.json ~status:`OK json_response |> Lwt_result.ok
|
||||||
|
| _ ->
|
||||||
|
Views.Job_build.make
|
||||||
|
~job_name
|
||||||
|
~build
|
||||||
|
~artifacts
|
||||||
|
~main_binary
|
||||||
|
~solo5_manifest
|
||||||
|
~same_input_same_output
|
||||||
|
~different_input_same_output
|
||||||
|
~same_input_different_output
|
||||||
|
~latest ~next ~previous
|
||||||
|
|> string_of_html |> Dream.html |> Lwt_result.ok
|
||||||
in
|
in
|
||||||
|
|
||||||
let job_build_file req =
|
let job_build_file req =
|
||||||
|
|
Loading…
Reference in a new issue