feat(CLI): Add optional --parameters to scheduled recipe (#8741)
Signed-off-by: Douwe Osinga <douwe@squareup.com> Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
@@ -576,6 +576,14 @@ enum SchedulerCommand {
|
||||
help = "Recipe source (path to file, or base64 encoded recipe string)"
|
||||
)]
|
||||
recipe_source: String,
|
||||
#[arg(
|
||||
long,
|
||||
value_name = "KEY=VALUE",
|
||||
help = "Recipe parameter in KEY=VALUE format (can be specified multiple times)",
|
||||
action = clap::ArgAction::Append,
|
||||
value_parser = parse_key_val,
|
||||
)]
|
||||
params: Vec<(String, String)>,
|
||||
},
|
||||
#[command(about = "List all scheduled jobs")]
|
||||
List {},
|
||||
@@ -1562,7 +1570,8 @@ async fn handle_schedule_command(command: SchedulerCommand) -> Result<()> {
|
||||
schedule_id,
|
||||
cron,
|
||||
recipe_source,
|
||||
} => handle_schedule_add(schedule_id, cron, recipe_source).await,
|
||||
params,
|
||||
} => handle_schedule_add(schedule_id, cron, recipe_source, params).await,
|
||||
SchedulerCommand::List {} => handle_schedule_list().await,
|
||||
SchedulerCommand::Remove { schedule_id } => handle_schedule_remove(schedule_id).await,
|
||||
SchedulerCommand::Sessions { schedule_id, limit } => {
|
||||
|
||||
@@ -69,6 +69,7 @@ pub async fn handle_schedule_add(
|
||||
schedule_id: String,
|
||||
cron: String,
|
||||
recipe_source_arg: String, // This is expected to be a file path by the Scheduler
|
||||
params: Vec<(String, String)>,
|
||||
) -> Result<()> {
|
||||
println!(
|
||||
"[CLI Debug] Scheduling job ID: {}, Cron: {}, Recipe Source Path: {}",
|
||||
@@ -88,6 +89,8 @@ pub async fn handle_schedule_add(
|
||||
paused: false,
|
||||
current_session_id: None,
|
||||
process_start_time: None,
|
||||
parameters: params,
|
||||
recipe_base_dir: None,
|
||||
};
|
||||
|
||||
let scheduler_storage_path =
|
||||
|
||||
Reference in New Issue
Block a user