Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions ocurrent-plugin/current_ocluster.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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
5 changes: 4 additions & 1 deletion ocurrent-plugin/current_ocluster.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand All @@ -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 ->
Expand All @@ -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 ->
Expand Down