Remove /refresh endpoint

It depends on builder-db add and was a hack anywya.
This commit is contained in:
Reynir Björnsson 2021-01-22 14:41:54 +01:00 committed by Gitea
parent 810e1393ed
commit 7a8f853663

View file

@ -149,33 +149,6 @@ let routes t =
|> Response.set_etag (Base64.encode_string (Cstruct.to_string digest)) |> Response.set_etag (Base64.encode_string (Cstruct.to_string digest))
in in
let refresh _req =
let status = Lwt_unix.system "builder-db add" in
let stream =
let i = ref 0 in
Lwt_stream.from (fun () ->
i := !i + 1;
match !i with
| 1 ->
Lwt.return_some "Refresh job started.\n"
| 2 ->
let* status = status in
(match status with
| Unix.WEXITED 0 ->
Lwt.return_some "Refresh job was successful!"
| Unix.WEXITED n ->
Lwt.return_some (Printf.sprintf "Refresh job failed : %d" n)
| Unix.WSIGNALED _ | Unix.WSTOPPED _ ->
Lwt.return_some ("Refresh job signalled"))
| _ ->
Lwt.return_none)
in
let body = Body.of_stream stream in
Response.make ~body ()
|> Response.set_content_type "text/plain"
|> Lwt.return
in
let upload req = let upload req =
let* body = Request.to_plain_text req in let* body = Request.to_plain_text req in
match Builder.Asn.exec_of_cs (Cstruct.of_string body) with match Builder.Asn.exec_of_cs (Cstruct.of_string body) with
@ -198,7 +171,6 @@ let routes t =
App.get "/job/:job/" job; App.get "/job/:job/" job;
App.get "/job/:job/build/:build/" job_build; App.get "/job/:job/build/:build/" job_build;
App.get "/job/:job/build/:build/f/**" job_build_file; App.get "/job/:job/build/:build/f/**" job_build_file;
App.get "/refresh" refresh;
App.post "/upload" (authorized t upload); App.post "/upload" (authorized t upload);
] ]