Skip to content

Commit

Permalink
Remove triggering prefix from build args to preserve backwards compat…
Browse files Browse the repository at this point in the history
…ibility
  • Loading branch information
benmandrew authored and shonfeder committed Aug 30, 2024
1 parent de4af1c commit baf3311
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions api/docker.ml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module Spec = struct
}

type options = {
triggering_build_args : string list;
build_args : string list;
nontriggering_build_args : string list;
squash : bool;
buildkit: bool;
Expand All @@ -50,7 +50,7 @@ module Spec = struct
}

let defaults = {
triggering_build_args = [];
build_args = [];
nontriggering_build_args = [];
squash = false;
buildkit = false;
Expand All @@ -66,8 +66,8 @@ module Spec = struct
| `Contents contents -> Dockerfile.contents_set dockerfile_b contents
| `Path path -> Dockerfile.path_set dockerfile_b path
end;
let { triggering_build_args; nontriggering_build_args; squash; buildkit; include_git } = options in
DB.triggering_build_args_set_list b triggering_build_args |> ignore;
let { build_args; nontriggering_build_args; squash; buildkit; include_git } = options in
DB.build_args_set_list b build_args |> ignore;
DB.nontriggering_build_args_set_list b nontriggering_build_args |> ignore;
DB.squash_set b squash;
DB.buildkit_set b buildkit;
Expand All @@ -92,12 +92,12 @@ module Spec = struct
let target = R.push_target_get r in
let user = R.push_user_get r in
let password = R.push_password_get r in
let triggering_build_args = R.triggering_build_args_get_list r in
let build_args = R.build_args_get_list r in
let nontriggering_build_args = R.nontriggering_build_args_get_list r in
let squash = R.squash_get r in
let buildkit = R.buildkit_get r in
let include_git = R.include_git_get r in
let options = { triggering_build_args; nontriggering_build_args; squash; buildkit; include_git } in
let options = { build_args; nontriggering_build_args; squash; buildkit; include_git } in
let push_to =
match target, user, password with
| "", "", "" -> None
Expand Down
2 changes: 1 addition & 1 deletion api/docker.mli
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module Spec : sig
}

type options = {
triggering_build_args : string list; (** "--build-arg" arguments, changing these arguments triggers an OCurrent rebuild *)
build_args : string list; (** "--build-arg" arguments, changing these arguments triggers an OCurrent rebuild *)
nontriggering_build_args : string list; (** Changing these arguments does not trigger a rebuild *)
squash : bool;
buildkit: bool;
Expand Down
4 changes: 2 additions & 2 deletions api/schema.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ struct DockerBuild {
pushUser @3 :Text;
pushPassword @4 :Text;

triggeringBuildArgs @5 :List(Text);
buildArgs @5 :List(Text);
nontriggeringBuildArgs @6 :List(Text);
# Options to pass to `docker build` using `--build-arg`.
# Triggering args trigger OCurrent rebuilds on changing, nontriggering args do not.
# buildArgs trigger OCurrent rebuilds on changing, nontriggeringBuildArgs do not.

squash @7 :Bool;
# Squash the image layers together using `--squash`.
Expand Down
10 changes: 5 additions & 5 deletions bin/client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ let push_password_file =
~docv:"PATH"
["push-password"]

let triggering_build_args =
let build_args =
Arg.value @@
Arg.(opt_all string) [] @@
Arg.info
~doc:"Docker build argument; triggers OCurrent rebuild on change."
~docv:"ARG"
["build-arg"; "triggering-build-arg"]
["build-arg"]

let nontriggering_build_args =
Arg.value @@
Expand Down Expand Up @@ -254,10 +254,10 @@ let push_to =
Term.(const make $ push_to $ push_user $ push_password_file)

let build_options =
let make triggering_build_args nontriggering_build_args squash buildkit include_git =
{ Cluster_api.Docker.Spec.triggering_build_args; nontriggering_build_args; squash; buildkit; include_git }
let make build_args nontriggering_build_args squash buildkit include_git =
{ Cluster_api.Docker.Spec.build_args; nontriggering_build_args; squash; buildkit; include_git }
in
Term.(const make $ triggering_build_args $ nontriggering_build_args $ squash $ buildkit $ include_git)
Term.(const make $ build_args $ nontriggering_build_args $ squash $ buildkit $ include_git)

let submit_options_common =
let make submission_path pool repository commits cache_hint urgent secrets =
Expand Down
4 changes: 2 additions & 2 deletions worker/cluster_worker.ml
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,8 @@ let default_build ?obuilder ~switch ~log ~src ~secrets = function
| Ok path -> Lwt_result.return path
| Error e -> Lwt_result.fail e
end >>!= fun dockerpath ->
let { Cluster_api.Docker.Spec.triggering_build_args; nontriggering_build_args; squash; buildkit; include_git = _ } = options in
let build_args = triggering_build_args @ nontriggering_build_args in
let { Cluster_api.Docker.Spec.build_args; nontriggering_build_args; squash; buildkit; include_git = _ } = options in
let build_args = build_args @ nontriggering_build_args in
let args =
List.concat_map (fun x -> ["--build-arg"; x]) build_args
@ (if squash then ["--squash"] else [])
Expand Down

0 comments on commit baf3311

Please sign in to comment.