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
3 changes: 3 additions & 0 deletions crates/cli/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
}

fn parse_svm_feature(s: &str) -> Result<SvmFeature, String> {
Expand Down
13 changes: 11 additions & 2 deletions crates/cli/src/cli/simnet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?;
Expand Down Expand Up @@ -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();
Expand All @@ -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");
Expand Down Expand Up @@ -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));
Expand All @@ -588,6 +592,7 @@ fn assemble_runbook_execution_futures(
simnet_events_tx: &Sender<SimnetEvent>,
on_disk_runbook_data: &Option<(FileLocation, Vec<String>)>,
in_memory_runbook_data: &Option<(String, RunbookSources, WorkspaceManifest)>,
runbook_input: &Vec<String>,
) -> Vec<std::pin::Pin<Box<dyn std::future::Future<Output = Result<(), String>> + Send>>> {
let mut futures: Vec<
std::pin::Pin<Box<dyn std::future::Future<Output = Result<(), String>> + Send>>,
Expand Down Expand Up @@ -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,
)));
}
Expand Down