diff --git a/crates/cli/src/cli/mod.rs b/crates/cli/src/cli/mod.rs index 7b558c43..f686f0ab 100644 --- a/crates/cli/src/cli/mod.rs +++ b/crates/cli/src/cli/mod.rs @@ -237,6 +237,9 @@ pub struct StartSimnet { /// Enable all SVM features (override mainnet defaults which are used by default) #[clap(long = "features-all", action=ArgAction::SetTrue, default_value = "false")] pub all_features: bool, + /// A set of inputs to use for the runbook (eg. surfpool start --runbook-input myInputs.json) + #[arg(long = "runbook-input", short = 'i', default_value = "./txtx.yml")] + pub runbook_input: Vec, } fn parse_svm_feature(s: &str) -> Result { diff --git a/crates/cli/src/cli/simnet/mod.rs b/crates/cli/src/cli/simnet/mod.rs index 5369d578..012ebce1 100644 --- a/crates/cli/src/cli/simnet/mod.rs +++ b/crates/cli/src/cli/simnet/mod.rs @@ -469,6 +469,7 @@ async fn write_and_execute_iac( } } + let runbook_input = cmd.runbook_input.clone(); // Is infrastructure-as-code (IaC) already setup? let base_location = FileLocation::from_path_string(&cmd.manifest_path)?.get_parent_location()?; @@ -510,6 +511,7 @@ async fn write_and_execute_iac( simnet_events_tx, &on_disk_runbook_data, &in_memory_runbook_data, + &runbook_input, ); let simnet_events_tx = simnet_events_tx.clone(); @@ -523,6 +525,7 @@ async fn write_and_execute_iac( if cmd.watch { let _handle = hiro_system_kit::thread_named("Watch Filesystem") .spawn(move || { + let runbook_input = runbook_input.clone(); let mut target_path = base_location.clone(); let _ = target_path.append_path("target"); let _ = target_path.append_path("deploy"); @@ -571,6 +574,7 @@ async fn write_and_execute_iac( &simnet_events_tx, &on_disk_runbook_data, &in_memory_runbook_data, + &runbook_input, ); let _ = hiro_system_kit::nestable_block_on(join_all(futures)); @@ -588,6 +592,7 @@ fn assemble_runbook_execution_futures( simnet_events_tx: &Sender, on_disk_runbook_data: &Option<(FileLocation, Vec)>, in_memory_runbook_data: &Option<(String, RunbookSources, WorkspaceManifest)>, + runbook_input: &Vec, ) -> Vec> + Send>>> { let mut futures: Vec< std::pin::Pin> + Send>>, @@ -619,8 +624,12 @@ fn assemble_runbook_execution_futures( futures.push(Box::pin(execute_on_disk_runbook( progress_tx.clone(), simnet_events_tx_copy.clone(), - ExecuteRunbook::default_localnet(&runbook_id_owned) - .with_manifest_path(file_location_owned.to_string()), + { + let mut ec = ExecuteRunbook::default_localnet(&runbook_id_owned) + .with_manifest_path(file_location_owned.to_string()); + ec.inputs = runbook_input.clone(); + ec + }, do_setup_logger, ))); }