Tweak json field names

Also add "main_binary" boolean field in comparison for consistency with
`job_build` json.
This commit is contained in:
Reynir Björnsson 2024-12-20 10:27:21 +01:00
parent 2c44f88460
commit c670df643e

View file

@ -404,8 +404,8 @@ let routes ~datadir ~cachedir ~configdir ~expired_jobs =
"job_name", `String job_name; "job_name", `String job_name;
"uuid", `String (Uuidm.to_string build.uuid); "uuid", `String (Uuidm.to_string build.uuid);
"platform", `String build.platform; "platform", `String build.platform;
"build_start_time", `String (Ptime.to_rfc3339 build.start); "start_time", `String (Ptime.to_rfc3339 build.start);
"build_finish_time", `String (Ptime.to_rfc3339 build.finish); "finish_time", `String (Ptime.to_rfc3339 build.finish);
"main_binary", (match build.main_binary with Some _ -> `Bool true | None -> `Bool false) "main_binary", (match build.main_binary with Some _ -> `Bool true | None -> `Bool false)
] |> Yojson.Basic.to_string ] |> Yojson.Basic.to_string
in in
@ -612,20 +612,22 @@ let routes ~datadir ~cachedir ~configdir ~expired_jobs =
let json_response = let json_response =
`Assoc [ `Assoc [
"left", `Assoc [ "left", `Assoc [
"job", `String job_left; "job_name", `String job_left;
"build", `String (Uuidm.to_string build_left.uuid); "uuid", `String (Uuidm.to_string build_left.uuid);
"platform", `String build_left.platform; "platform", `String build_left.platform;
"build_start_time", `String (Ptime.to_rfc3339 build_left.start); "start_time", `String (Ptime.to_rfc3339 build_left.start);
"build_finish_time", `String (Ptime.to_rfc3339 build_left.finish); "finish_time", `String (Ptime.to_rfc3339 build_left.finish);
"build_size", file_size_json build_left_file_size; "main_binary", `Bool (Option.is_some build_left_file_size);
"main_binary_size", file_size_json build_left_file_size;
]; ];
"right", `Assoc [ "right", `Assoc [
"job", `String job_right; "job_name", `String job_right;
"build", `String (Uuidm.to_string build_right.uuid); "build", `String (Uuidm.to_string build_right.uuid);
"platform", `String build_right.platform; "platform", `String build_right.platform;
"build_start_time", `String (Ptime.to_rfc3339 build_right.start); "start_time", `String (Ptime.to_rfc3339 build_right.start);
"build_finish_time", `String (Ptime.to_rfc3339 build_right.finish); "finish_time", `String (Ptime.to_rfc3339 build_right.finish);
"build_size", file_size_json build_right_file_size; "main_binary", `Bool (Option.is_some build_right_file_size);
"main_binary_size", file_size_json build_right_file_size;
]; ];
"env_diff", Utils.diff_map_to_json env_diff; "env_diff", Utils.diff_map_to_json env_diff;
"package_diff", Utils.diff_map_to_json pkg_diff; "package_diff", Utils.diff_map_to_json pkg_diff;