Skip to main content

RuntimeContext

Struct RuntimeContext 

Source
pub struct RuntimeContext {
    pub base: ExecutionContext,
    pub current_stage: Option<String>,
    pub current_job: Option<String>,
    pub stage_results: HashMap<String, StageResult>,
    pub job_results: HashMap<String, JobResult>,
    pub step_results: Vec<StepResult>,
    pub variables: HashMap<String, Value>,
    pub parameters: HashMap<String, Value>,
    pub env: HashMap<String, Value>,
    pub step_outputs: HashMap<String, HashMap<String, Value>>,
}
Expand description

Runtime context during pipeline execution

Fields§

§base: ExecutionContext

Base execution context (pipeline name, working dir, etc.)

§current_stage: Option<String>

Current stage being executed

§current_job: Option<String>

Current job being executed

§stage_results: HashMap<String, StageResult>

Completed stage results

§job_results: HashMap<String, JobResult>

Completed job results (indexed by “stage.job” or just “job” for implicit stage)

§step_results: Vec<StepResult>

Current job’s step results

§variables: HashMap<String, Value>

All variables (merged from pipeline, stage, job levels)

§parameters: HashMap<String, Value>

All parameters

§env: HashMap<String, Value>

Environment variables

§step_outputs: HashMap<String, HashMap<String, Value>>

Output variables from steps (step_name -> output_name -> value)

Implementations§

Source§

impl RuntimeContext

Source

pub fn new(base: ExecutionContext) -> Self

Create a new runtime context from base execution context

Source

pub fn from_pipeline(pipeline: &Pipeline, working_dir: String) -> Self

Create a new runtime context from a pipeline

Source

pub fn enter_stage(&mut self, stage: &Stage)

Enter a stage (set current stage and merge variables)

Source

pub fn exit_stage(&mut self, result: StageResult)

Exit current stage with result

Source

pub fn enter_job(&mut self, job: &Job)

Enter a job (set current job and merge variables)

Source

pub fn exit_job(&mut self, result: JobResult)

Exit current job with result

Source

pub fn record_step_result(&mut self, result: StepResult)

Record a step result

Source

pub fn set_variable(&mut self, name: String, value: Value)

Set a variable during execution

Source

pub fn set_step_output( &mut self, step_name: String, output_name: String, value: Value, )

Set an output variable for the current step

Source

pub fn set_env(&mut self, name: String, value: Value)

Set an environment variable

Source

pub fn merge_pipeline_variables(&mut self, variables: &[Variable])

Merge pipeline-level variables (public entry point for the executor)

Source

pub fn to_expression_context(&self) -> ExpressionContext

Build an ExpressionContext for evaluating conditions

Source

pub fn expression_engine(&self) -> ExpressionEngine

Create an expression engine with current context

Source

pub fn evaluate_condition(&self, condition: &str) -> Result<bool, String>

Evaluate a condition expression

Source

pub fn substitute_variables(&self, text: &str) -> Result<String, String>

Substitute variables in a string ($(var) syntax)

Source

pub fn dependencies_succeeded(&self, deps: &[String], is_stage: bool) -> bool

Check if all dependencies succeeded

Source

pub fn env_as_strings(&self) -> HashMap<String, String>

Get environment variables as string map for process execution

Trait Implementations§

Source§

impl Clone for RuntimeContext

Source§

fn clone(&self) -> RuntimeContext

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RuntimeContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.