diff --git a/ocurrent-plugin/current_ocluster.ml b/ocurrent-plugin/current_ocluster.ml index c42a7464..4d3e2844 100644 --- a/ocurrent-plugin/current_ocluster.ml +++ b/ocurrent-plugin/current_ocluster.ml @@ -143,10 +143,11 @@ open Current.Syntax let v ?timeout ?push_auth ?(urgent=`Auto) connection = { connection; timeout; push_auth; cache_hint = None; urgent } -let label dockerfile pool = +let component_label label dockerfile pool = + let pp_label = Fmt.(option (cut ++ string)) in match dockerfile with - | `Path path -> Current.component "build %s@,%s" path pool - | `Contents _ -> Current.component "build@,%s" pool + | `Path path -> Current.component "build %s@,%s%a" path pool pp_label label + | `Contents _ -> Current.component "build@,%s%a" pool pp_label label module Raw = struct let with_hint ~cache_hint t = @@ -180,20 +181,20 @@ let unwrap = function | `Path _ as x -> Current.return x | `Contents x -> Current.map (fun x -> `Contents x) x -let build_and_push ?cache_hint t ~push_target ~pool ~src ~options dockerfile = - label dockerfile pool |> +let build_and_push ?label ?cache_hint t ~push_target ~pool ~src ~options dockerfile = + component_label label dockerfile pool |> let> dockerfile = unwrap dockerfile and> src = src in Raw.build_and_push ?cache_hint t ~push_target ~pool ~src ~options dockerfile -let build ?cache_hint t ~pool ~src ~options dockerfile = - label dockerfile pool |> +let build ?label ?cache_hint t ~pool ~src ~options dockerfile = + component_label label dockerfile pool |> let> dockerfile = unwrap dockerfile and> src = src in Raw.build ?cache_hint t ~pool ~src ~options dockerfile -let build_obuilder ?cache_hint t ~pool ~src spec = - Current.component "obuild@,%s" pool |> +let build_obuilder ?label ?cache_hint t ~pool ~src spec = + Current.component "obuild@,%s%a" pool Fmt.(option (cut ++ string)) label |> let> spec = spec and> src = src in Raw.build_obuilder ?cache_hint t ~pool ~src spec diff --git a/ocurrent-plugin/current_ocluster.mli b/ocurrent-plugin/current_ocluster.mli index 608ccfc9..c541aede 100644 --- a/ocurrent-plugin/current_ocluster.mli +++ b/ocurrent-plugin/current_ocluster.mli @@ -34,7 +34,8 @@ val with_push_auth : (string * string) option -> t -> t val with_urgent : urgency -> t -> t (** [with_urgent x t] is a copy of [t] with urgency policy [x]. *) -val build : +val build : + ?label:string -> ?cache_hint:string -> t -> pool:string -> @@ -46,6 +47,7 @@ val build : Note: all commits in [src] must be in the same repository. *) val build_and_push : + ?label:string -> ?cache_hint:string -> t -> push_target:Cluster_api.Docker.Image_id.t -> @@ -59,6 +61,7 @@ val build_and_push : If [t] doesn't have [push_auth] configured, this still tests the build, but returns an error at the end. *) val build_obuilder : + ?label:string -> ?cache_hint:string -> t -> pool:string ->