store relative path for console and script

This commit is contained in:
Robur 2021-09-07 11:53:51 +00:00
parent 0628938898
commit 8279bc1c26
2 changed files with 6 additions and 6 deletions

View file

@ -157,12 +157,12 @@ let console_of_string data =
Asn.console_to_cs console
let save_console_and_script datadir job_name uuid console script =
let out name = Fpath.(datadir / job_name / Uuidm.to_string uuid / name + "txt") in
let out name = Fpath.(v job_name / Uuidm.to_string uuid / name + "txt") in
let script_out = out "script" in
Bos.OS.File.write script_out script >>= fun () ->
Bos.OS.File.write Fpath.(datadir // script_out) script >>= fun () ->
let console_out = out "console" in
console_to_string console >>= fun console_data ->
Bos.OS.File.write console_out console_data >>= fun () ->
Bos.OS.File.write Fpath.(datadir // console_out) console_data >>= fun () ->
Ok (console_out, script_out)
let read_console_and_script datadir console_file script_file =

View file

@ -274,8 +274,8 @@ let compute_input_id artifacts =
| Some a, Some b, Some c -> Some (Mirage_crypto.Hash.SHA256.digest (Cstruct.concat [a;b;c]))
| _ -> None
let save_console_and_script staging_dir datadir job_name uuid console script =
let out name = Fpath.(datadir / job_name / Uuidm.to_string uuid / name + "txt") in
let save_console_and_script staging_dir job_name uuid console script =
let out name = Fpath.(v job_name / Uuidm.to_string uuid / name + "txt") in
let out_staging name = Fpath.(staging_dir / name + "txt") in
let console_to_string console =
List.rev_map (fun (delta, data) ->
@ -318,7 +318,7 @@ let add_build
List.filter (fun (p, _) -> not (not_interesting p)) raw_artifacts
in
or_cleanup (prepare_staging staging_dir) >>= fun () ->
or_cleanup (save_console_and_script staging_dir datadir job_name uuid console job.Builder.script)
or_cleanup (save_console_and_script staging_dir job_name uuid console job.Builder.script)
>>= fun (console, script) ->
or_cleanup (save_all staging_dir job uuid artifacts_to_preserve) >>= fun artifacts ->
let r =