@@ -46,6 +46,8 @@ pub struct LocalKubernetesNetConfig {
4646 pub num_initial_validators : usize ,
4747 pub num_shards : usize ,
4848 pub binaries : BuildArg ,
49+ pub no_build : bool ,
50+ pub docker_image_name : String ,
4951 pub policy : ResourceControlPolicy ,
5052}
5153
@@ -62,6 +64,8 @@ pub struct LocalKubernetesNet {
6264 next_client_id : usize ,
6365 tmp_dir : Arc < TempDir > ,
6466 binaries : BuildArg ,
67+ no_build : bool ,
68+ docker_image_name : String ,
6569 kubectl_instance : Arc < Mutex < KubectlInstance > > ,
6670 kind_clusters : Vec < KindCluster > ,
6771 num_initial_validators : usize ,
@@ -96,6 +100,8 @@ impl SharedLocalKubernetesNetTestingConfig {
96100 num_initial_validators : 4 ,
97101 num_shards : 4 ,
98102 binaries,
103+ no_build : false ,
104+ docker_image_name : String :: from ( "linera:latest" ) ,
99105 policy : ResourceControlPolicy :: devnet ( ) ,
100106 } )
101107 }
@@ -122,6 +128,8 @@ impl LineraNetConfig for LocalKubernetesNetConfig {
122128 self . network ,
123129 self . testing_prng_seed ,
124130 self . binaries ,
131+ self . no_build ,
132+ self . docker_image_name ,
125133 KubectlInstance :: new ( Vec :: new ( ) ) ,
126134 clusters,
127135 self . num_initial_validators ,
@@ -300,10 +308,13 @@ impl LineraNet for LocalKubernetesNet {
300308}
301309
302310impl LocalKubernetesNet {
311+ #[ allow( clippy:: too_many_arguments) ]
303312 fn new (
304313 network : Network ,
305314 testing_prng_seed : Option < u64 > ,
306315 binaries : BuildArg ,
316+ no_build : bool ,
317+ docker_image_name : String ,
307318 kubectl_instance : KubectlInstance ,
308319 kind_clusters : Vec < KindCluster > ,
309320 num_initial_validators : usize ,
@@ -315,6 +326,8 @@ impl LocalKubernetesNet {
315326 next_client_id : 0 ,
316327 tmp_dir : Arc :: new ( tempdir ( ) ?) ,
317328 binaries,
329+ no_build,
330+ docker_image_name,
318331 kubectl_instance : Arc :: new ( Mutex :: new ( kubectl_instance) ) ,
319332 kind_clusters,
320333 num_initial_validators,
@@ -394,8 +407,12 @@ impl LocalKubernetesNet {
394407 async fn run ( & mut self ) -> Result < ( ) > {
395408 let github_root = get_github_root ( ) . await ?;
396409 // Build Docker image
397- let docker_image =
398- DockerImage :: build ( String :: from ( "linera:latest" ) , & self . binaries , & github_root) . await ?;
410+ let docker_image_name = if self . no_build {
411+ self . docker_image_name . clone ( )
412+ } else {
413+ DockerImage :: build ( & self . docker_image_name , & self . binaries , & github_root) . await ?;
414+ self . docker_image_name . clone ( )
415+ } ;
399416
400417 let base_dir = github_root
401418 . join ( "kubernetes" )
@@ -412,13 +429,13 @@ impl LocalKubernetesNet {
412429
413430 let mut validators_initialization_futures = Vec :: new ( ) ;
414431 for ( i, kind_cluster) in self . kind_clusters . iter ( ) . cloned ( ) . enumerate ( ) {
415- let docker_image_name = docker_image. name ( ) . to_string ( ) ;
416432 let base_dir = base_dir. clone ( ) ;
417433 let github_root = github_root. clone ( ) ;
418434
419435 let kubectl_instance = kubectl_instance_clone. clone ( ) ;
420436 let tmp_dir_path = tmp_dir_path_clone. clone ( ) ;
421437
438+ let docker_image_name = docker_image_name. clone ( ) ;
422439 let future = async move {
423440 let cluster_id = kind_cluster. id ( ) ;
424441 kind_cluster. load_docker_image ( & docker_image_name) . await ?;
0 commit comments