pub struct ShellConfig {
pub command: String,
pub timeout_secs: Option<u64>,
pub dir: Option<String>,
pub env: Vec<(String, String)>,
pub clean_env: bool,
pub outputs: Vec<ArtifactOutput>,
pub inputs: Vec<ArtifactInput>,
pub allow_failure: bool,
pub retry: Option<RetryPolicy>,
}Expand description
Serializable configuration for a shell step.
§Examples
use ironflow_engine::config::ShellConfig;
let config = ShellConfig::new("cargo build --release")
.timeout_secs(300)
.dir("/app")
.output("target/report.html");Fields§
§command: StringThe shell command to execute.
timeout_secs: Option<u64>Timeout in seconds (default: 300).
dir: Option<String>Working directory.
env: Vec<(String, String)>Environment variables to set.
clean_env: boolIf true, start with a clean environment.
outputs: Vec<ArtifactOutput>Files the step promises to produce, collected once it finishes.
inputs: Vec<ArtifactInput>Artifacts of earlier steps to place in the working directory first.
allow_failure: boolWhen true, a failure of this step does not fail the run. The step is
still marked Failed but execution continues and the run finishes with
[RunStatus::Warning] instead of Failed.
retry: Option<RetryPolicy>Optional step-level retry policy. When set, a transient failure retries the step locally with exponential backoff before propagating the error.
Implementations§
Source§impl ShellConfig
impl ShellConfig
Sourcepub fn new(command: &str) -> Self
pub fn new(command: &str) -> Self
Create a new shell config with the given command.
§Examples
use ironflow_engine::config::ShellConfig;
let config = ShellConfig::new("echo hello");
assert_eq!(config.command, "echo hello");Sourcepub fn timeout_secs(self, secs: u64) -> Self
pub fn timeout_secs(self, secs: u64) -> Self
Set the timeout in seconds.
Sourcepub fn output(self, pattern: &str) -> Self
pub fn output(self, pattern: &str) -> Self
Declare a file the step produces, typed from its name.
pattern is a glob resolved against dir. Every match is
stored as an artifact named after the file. When the step succeeds and
the pattern matches nothing, the step fails.
§Examples
use ironflow_engine::config::ShellConfig;
let config = ShellConfig::new("cargo build").output("target/*.log");
assert_eq!(config.outputs.len(), 1);Sourcepub fn output_typed(self, pattern: &str, content_type: &str) -> Self
pub fn output_typed(self, pattern: &str, content_type: &str) -> Self
Declare a produced file with an explicit MIME type.
§Examples
use ironflow_engine::config::ShellConfig;
let config = ShellConfig::new("./gen").output_typed("data", "application/json");
assert_eq!(config.outputs[0].content_type.as_deref(), Some("application/json"));Sourcepub fn input(self, step: &str, name: &str) -> Self
pub fn input(self, step: &str, name: &str) -> Self
Consume an artifact produced by an earlier step of the same run.
It is written into the working directory under its own name before the
command runs. Use input_at to choose another path.
§Examples
use ironflow_engine::config::ShellConfig;
let config = ShellConfig::new("./publish").input("build", "report.html");
assert_eq!(config.inputs[0].destination(), "report.html");Sourcepub fn allow_failure(self) -> Self
pub fn allow_failure(self) -> Self
Mark this step as allowed to fail without stopping the run.
§Examples
use ironflow_engine::config::ShellConfig;
let config = ShellConfig::new("cargo clippy").allow_failure();
assert!(config.allow_failure);Sourcepub fn retry_policy(self, policy: RetryPolicy) -> Self
pub fn retry_policy(self, policy: RetryPolicy) -> Self
Set a step-level retry policy.
§Examples
use ironflow_core::retry::RetryPolicy;
use ironflow_engine::config::ShellConfig;
let config = ShellConfig::new("curl http://api")
.retry_policy(RetryPolicy::new(3));
assert!(config.retry.is_some());Sourcepub fn input_at(self, step: &str, name: &str, dest: &str) -> Self
pub fn input_at(self, step: &str, name: &str, dest: &str) -> Self
Consume an artifact and write it to an explicit path.
§Examples
use ironflow_engine::config::ShellConfig;
let config = ShellConfig::new("./publish").input_at("build", "report.html", "in/r.html");
assert_eq!(config.inputs[0].destination(), "in/r.html");Trait Implementations§
Source§impl Clone for ShellConfig
impl Clone for ShellConfig
Source§fn clone(&self) -> ShellConfig
fn clone(&self) -> ShellConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more