diff --git a/tezt/lib_cloud/cli.ml b/tezt/lib_cloud/cli.ml index 1c4ee03eb26c4a8dd99b7a69949ea828b2460d90..ab63df141f16718ea26a51ad7ab43eb17611145d 100644 --- a/tezt/lib_cloud/cli.ml +++ b/tezt/lib_cloud/cli.ml @@ -263,3 +263,15 @@ let check_file_consistency = Although a scenario can opt in or opt out, this flag sets the default \ behavior. Its default value is [true] unless [--macosx] is used." (not macosx) + +let push_docker = + Clap.flag + ~section + ~unset_long:"no-docker-push" + ~description: + "When used in cloud mode (--cloud) or proxy mode (--proxy), by default, \ + `tezt-cloud` pushes the Docker containers on GCP. To save some \ + bandwidth or some time during a redeployment that won't add or remove \ + VMs that are already running, it is useful to prevent those containers \ + to be pushed." + true diff --git a/tezt/lib_cloud/cli.mli b/tezt/lib_cloud/cli.mli index b98f947c9b887e806d5d4d1fdaa957e84ad90e3f..9434b77b21661d2924f1985525d9ee8fdc8d6ccc 100644 --- a/tezt/lib_cloud/cli.mli +++ b/tezt/lib_cloud/cli.mli @@ -112,3 +112,7 @@ val macosx : bool (** Check for file consistency. *) val check_file_consistency : bool + +(** Specify if the docker container should be pushed. + Only considered for remote mode. *) +val push_docker : bool diff --git a/tezt/lib_cloud/cloud.ml b/tezt/lib_cloud/cloud.ml index dffd8918d10c450d7a35ff4999bf625aa016f8ff..48292b10c1864a9540dfdf37f5f3eb2900a89210 100644 --- a/tezt/lib_cloud/cloud.ml +++ b/tezt/lib_cloud/cloud.ml @@ -569,7 +569,7 @@ let register ?proxy_files ?proxy_args ?vms ~__FILE__ ~title ~tags ?seed | `Cloud -> (* The scenario is executed locally and the VMs are on the cloud. *) let* () = Jobs.deploy_docker_registry () in - let* () = Jobs.docker_build ~push:true () in + let* () = Jobs.docker_build ~push:Env.push_docker () in let* deployement = Deployement.deploy ~configurations in let* () = Deployement.agents deployement @@ -582,7 +582,7 @@ let register ?proxy_files ?proxy_args ?vms ~__FILE__ ~title ~tags ?seed let* proxy_running = try_reattach () in if not proxy_running then let* () = Jobs.deploy_docker_registry () in - let* () = Jobs.docker_build ~push:true () in + let* () = Jobs.docker_build ~push:Env.push_docker () in let* deployement = Deployement.deploy ~configurations in let* () = Deployement.agents deployement diff --git a/tezt/lib_cloud/deployement.ml b/tezt/lib_cloud/deployement.ml index 93b09de8a8049180c22ecc077f7bcef9b7620014..68f28d5577e7ff85614b95bd1346e41cb2e32643 100644 --- a/tezt/lib_cloud/deployement.ml +++ b/tezt/lib_cloud/deployement.ml @@ -189,7 +189,7 @@ module Remote = struct let* () = Jobs.docker_build ~docker_image:configuration.Configuration.docker_image - ~push:true + ~push:Env.push_docker () in let* () = Terraform.VM.Workspace.select workspace_name in diff --git a/tezt/lib_cloud/env.ml b/tezt/lib_cloud/env.ml index 8f2e9f5bb324a0cb81d23382da9702c9636954fa..7ecffac7d9537c5493dd16a125c176f4eed394b6 100644 --- a/tezt/lib_cloud/env.ml +++ b/tezt/lib_cloud/env.ml @@ -83,6 +83,8 @@ let macosx = Cli.macosx let check_file_consistency = Cli.check_file_consistency +let push_docker = Cli.push_docker + let project_id = Gcloud.project_id let init () = diff --git a/tezt/lib_cloud/env.mli b/tezt/lib_cloud/env.mli index 9ae789f6cff7546472dbb29f8ad8eafe329baac6..2ace4f4fab29986a046e1483b7cd1bb1c6209f8a 100644 --- a/tezt/lib_cloud/env.mli +++ b/tezt/lib_cloud/env.mli @@ -10,11 +10,11 @@ type docker_image = Gcp of {alias : string} | Octez_release of {tag : string} -(** Equivalent to [Cli.tezt_cloud], but if not present, checks if `TEZT_CLOUD` +(** Equivalent to [Cli.tezt_cloud], but if not present, checks if `TEZT_CLOUD` is provided. *) val tezt_cloud : string -(** [ssh_private_key_filename ?home ()] returns the private key path associated to +(** [ssh_private_key_filename ?home ()] returns the private key path associated to the [?home] path and the [tezt_cloud] argument. *) val ssh_private_key_filename : ?home:string -> unit -> string @@ -114,10 +114,13 @@ val macosx : bool (** Equivalent to [Cli.check_file_consistency]. *) val check_file_consistency : bool +(** Equivalent to [Cli.push_docker]. *) +val push_docker : bool + (** Equivalent to [Gcloud.project_id]. *) val project_id : unit -> string Lwt.t -(** [init ()] initialises and deploys a Docker registry using Terraform, only when the +(** [init ()] initialises and deploys a Docker registry using Terraform, only when the [mode] is either [`Host] or [`Cloud]. *) val init : unit -> unit Lwt.t @@ -132,8 +135,8 @@ val registry_uri : unit -> string Lwt.t [docker_image]'s type. *) val uri_of_docker_image : docker_image -> string Lwt.t -(** [wait_process ?sleep ~is_ready ~run ()] recursively waits for [~run] process to be ready. - When the process is successful, but no [~is_ready], it loops after [?sleep] seconds. If +(** [wait_process ?sleep ~is_ready ~run ()] recursively waits for [~run] process to be ready. + When the process is successful, but no [~is_ready], it loops after [?sleep] seconds. If it is ready, it returns the read output. If it fails, this gets logged. *) val wait_process : ?sleep:int -> @@ -142,11 +145,11 @@ val wait_process : unit -> string Lwt.t -(** [run_command ?cmd_wrapper cmd args] can wrap the command given by [cmd] and [args] with +(** [run_command ?cmd_wrapper cmd args] can wrap the command given by [cmd] and [args] with a [Gcloud] wrapper, depending on the value of [?cmd_wrapper]. *) val run_command : ?cmd_wrapper:Gcloud.cmd_wrapper -> string -> string list -> Process.t -(** [dns_domains ()] returns a list of fully qualified domain names (FQDNs) based on current +(** [dns_domains ()] returns a list of fully qualified domain names (FQDNs) based on current configuration (given by [Cli.dns_domains]) and [mode] of operation. *) val dns_domains : unit -> string list Lwt.t