Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
6c16c89379
|
|||
|
e515ffbe0c
|
|||
|
978109d3fc
|
@@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [1.6.1] - 2026-04-05
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- **wfe-core**: `StepBuilder::config()` for attaching arbitrary JSON configuration to individual steps, readable at runtime via `context.step.step_config`
|
||||||
|
|
||||||
## [1.6.0] - 2026-04-01
|
## [1.6.0] - 2026-04-01
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
20
Cargo.toml
20
Cargo.toml
@@ -3,7 +3,7 @@ members = ["wfe-core", "wfe-sqlite", "wfe-postgres", "wfe-opensearch", "wfe-valk
|
|||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "1.6.0"
|
version = "1.6.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://src.sunbeam.pt/studio/wfe"
|
repository = "https://src.sunbeam.pt/studio/wfe"
|
||||||
@@ -38,15 +38,15 @@ redis = { version = "0.27", features = ["tokio-comp", "connection-manager"] }
|
|||||||
opensearch = "2"
|
opensearch = "2"
|
||||||
|
|
||||||
# Internal crates
|
# Internal crates
|
||||||
wfe-core = { version = "1.6.0", path = "wfe-core", registry = "sunbeam" }
|
wfe-core = { version = "1.6.1", path = "wfe-core", registry = "sunbeam" }
|
||||||
wfe-sqlite = { version = "1.6.0", path = "wfe-sqlite", registry = "sunbeam" }
|
wfe-sqlite = { version = "1.6.1", path = "wfe-sqlite", registry = "sunbeam" }
|
||||||
wfe-postgres = { version = "1.6.0", path = "wfe-postgres", registry = "sunbeam" }
|
wfe-postgres = { version = "1.6.1", path = "wfe-postgres", registry = "sunbeam" }
|
||||||
wfe-opensearch = { version = "1.6.0", path = "wfe-opensearch", registry = "sunbeam" }
|
wfe-opensearch = { version = "1.6.1", path = "wfe-opensearch", registry = "sunbeam" }
|
||||||
wfe-valkey = { version = "1.6.0", path = "wfe-valkey", registry = "sunbeam" }
|
wfe-valkey = { version = "1.6.1", path = "wfe-valkey", registry = "sunbeam" }
|
||||||
wfe-yaml = { version = "1.6.0", path = "wfe-yaml", registry = "sunbeam" }
|
wfe-yaml = { version = "1.6.1", path = "wfe-yaml", registry = "sunbeam" }
|
||||||
wfe-buildkit = { version = "1.6.0", path = "wfe-buildkit", registry = "sunbeam" }
|
wfe-buildkit = { version = "1.6.1", path = "wfe-buildkit", registry = "sunbeam" }
|
||||||
wfe-containerd = { version = "1.6.0", path = "wfe-containerd", registry = "sunbeam" }
|
wfe-containerd = { version = "1.6.1", path = "wfe-containerd", registry = "sunbeam" }
|
||||||
wfe-rustlang = { version = "1.6.0", path = "wfe-rustlang", registry = "sunbeam" }
|
wfe-rustlang = { version = "1.6.1", path = "wfe-rustlang", registry = "sunbeam" }
|
||||||
|
|
||||||
# YAML
|
# YAML
|
||||||
serde_yaml = "0.9"
|
serde_yaml = "0.9"
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ async-trait = { workspace = true }
|
|||||||
tracing = { workspace = true }
|
tracing = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
regex = { workspace = true }
|
regex = { workspace = true }
|
||||||
wfe-buildkit-protos = { version = "1.6.0", path = "../wfe-buildkit-protos", registry = "sunbeam" }
|
wfe-buildkit-protos = { version = "1.6.1", path = "../wfe-buildkit-protos", registry = "sunbeam" }
|
||||||
tonic = "0.14"
|
tonic = "0.14"
|
||||||
tower = { version = "0.4", features = ["util"] }
|
tower = { version = "0.4", features = ["util"] }
|
||||||
hyper-util = { version = "0.1", features = ["tokio"] }
|
hyper-util = { version = "0.1", features = ["tokio"] }
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ description = "containerd container runner executor for WFE"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wfe-core = { workspace = true }
|
wfe-core = { workspace = true }
|
||||||
wfe-containerd-protos = { version = "1.6.0", path = "../wfe-containerd-protos", registry = "sunbeam" }
|
wfe-containerd-protos = { version = "1.6.1", path = "../wfe-containerd-protos", registry = "sunbeam" }
|
||||||
tokio = { workspace = true }
|
tokio = { workspace = true }
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
|
|||||||
@@ -43,6 +43,14 @@ impl<D: WorkflowData> StepBuilder<D> {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Attach arbitrary JSON configuration to this step.
|
||||||
|
///
|
||||||
|
/// The step can read it at runtime via `context.step.step_config`.
|
||||||
|
pub fn config(mut self, config: serde_json::Value) -> Self {
|
||||||
|
self.builder.steps[self.step_id].step_config = Some(config);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Add a compensation step for saga rollback.
|
/// Add a compensation step for saga rollback.
|
||||||
pub fn compensate_with<C: StepBody + Default + 'static>(mut self) -> Self {
|
pub fn compensate_with<C: StepBody + Default + 'static>(mut self) -> Self {
|
||||||
let comp_id = self.builder.add_step(std::any::type_name::<C>());
|
let comp_id = self.builder.add_step(std::any::type_name::<C>());
|
||||||
|
|||||||
@@ -341,6 +341,51 @@ mod tests {
|
|||||||
assert!(def.steps[1].step_type.contains("StepB"));
|
assert!(def.steps[1].step_type.contains("StepB"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn config_sets_step_config() {
|
||||||
|
let cfg = serde_json::json!({"namespace": "ory", "timeout": 30});
|
||||||
|
let def = WorkflowBuilder::<TestData>::new()
|
||||||
|
.start_with::<StepA>()
|
||||||
|
.config(cfg.clone())
|
||||||
|
.end_workflow()
|
||||||
|
.build("test", 1);
|
||||||
|
assert_eq!(def.steps[0].step_config, Some(cfg));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn config_chains_with_name() {
|
||||||
|
let cfg = serde_json::json!({"namespace": "data"});
|
||||||
|
let def = WorkflowBuilder::<TestData>::new()
|
||||||
|
.start_with::<StepA>()
|
||||||
|
.name("apply-data")
|
||||||
|
.config(cfg.clone())
|
||||||
|
.then::<StepB>()
|
||||||
|
.end_workflow()
|
||||||
|
.build("test", 1);
|
||||||
|
assert_eq!(def.steps[0].name, Some("apply-data".into()));
|
||||||
|
assert_eq!(def.steps[0].step_config, Some(cfg));
|
||||||
|
assert_eq!(def.steps[0].outcomes[0].next_step, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn config_on_multiple_steps_of_same_type() {
|
||||||
|
let cfg_a = serde_json::json!({"namespace": "ory"});
|
||||||
|
let cfg_b = serde_json::json!({"namespace": "data"});
|
||||||
|
let def = WorkflowBuilder::<TestData>::new()
|
||||||
|
.start_with::<StepA>()
|
||||||
|
.name("apply-ory")
|
||||||
|
.config(cfg_a.clone())
|
||||||
|
.then::<StepA>()
|
||||||
|
.name("apply-data")
|
||||||
|
.config(cfg_b.clone())
|
||||||
|
.end_workflow()
|
||||||
|
.build("test", 1);
|
||||||
|
assert_eq!(def.steps[0].step_config, Some(cfg_a));
|
||||||
|
assert_eq!(def.steps[1].step_config, Some(cfg_b));
|
||||||
|
// Both are StepA
|
||||||
|
assert_eq!(def.steps[0].step_type, def.steps[1].step_type);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn inline_step_via_then_fn() {
|
fn inline_step_via_then_fn() {
|
||||||
let def = WorkflowBuilder::<TestData>::new()
|
let def = WorkflowBuilder::<TestData>::new()
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ path = "src/main.rs"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
# Internal
|
# Internal
|
||||||
wfe-core = { workspace = true, features = ["test-support"] }
|
wfe-core = { workspace = true, features = ["test-support"] }
|
||||||
wfe = { path = "../wfe" }
|
wfe = { version = "1.6.1", path = "../wfe", registry = "sunbeam" }
|
||||||
wfe-yaml = { path = "../wfe-yaml", features = ["rustlang", "buildkit", "containerd"] }
|
wfe-yaml = { version = "1.6.1", path = "../wfe-yaml", registry = "sunbeam", features = ["rustlang", "buildkit", "containerd"] }
|
||||||
wfe-server-protos = { path = "../wfe-server-protos" }
|
wfe-server-protos = { version = "1.6.1", path = "../wfe-server-protos", registry = "sunbeam" }
|
||||||
wfe-sqlite = { workspace = true }
|
wfe-sqlite = { workspace = true }
|
||||||
wfe-postgres = { workspace = true }
|
wfe-postgres = { workspace = true }
|
||||||
wfe-valkey = { workspace = true }
|
wfe-valkey = { workspace = true }
|
||||||
|
|||||||
Reference in New Issue
Block a user