Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
2b244348ca
|
|||
|
de66fef2d6
|
@@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
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.2] - 2026-04-05
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- **wfe-core**: `WorkflowBuilder::add_step_typed()` for adding named, configured steps in parallel branch closures
|
||||||
|
- **wfe-core**: `WorkflowBuilder::wire_outcome()` now public for custom graph wiring
|
||||||
|
|
||||||
## [1.6.1] - 2026-04-05
|
## [1.6.1] - 2026-04-05
|
||||||
|
|
||||||
### 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.1"
|
version = "1.6.2"
|
||||||
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.1", path = "wfe-core", registry = "sunbeam" }
|
wfe-core = { version = "1.6.2", path = "wfe-core", registry = "sunbeam" }
|
||||||
wfe-sqlite = { version = "1.6.1", path = "wfe-sqlite", registry = "sunbeam" }
|
wfe-sqlite = { version = "1.6.2", path = "wfe-sqlite", registry = "sunbeam" }
|
||||||
wfe-postgres = { version = "1.6.1", path = "wfe-postgres", registry = "sunbeam" }
|
wfe-postgres = { version = "1.6.2", path = "wfe-postgres", registry = "sunbeam" }
|
||||||
wfe-opensearch = { version = "1.6.1", path = "wfe-opensearch", registry = "sunbeam" }
|
wfe-opensearch = { version = "1.6.2", path = "wfe-opensearch", registry = "sunbeam" }
|
||||||
wfe-valkey = { version = "1.6.1", path = "wfe-valkey", registry = "sunbeam" }
|
wfe-valkey = { version = "1.6.2", path = "wfe-valkey", registry = "sunbeam" }
|
||||||
wfe-yaml = { version = "1.6.1", path = "wfe-yaml", registry = "sunbeam" }
|
wfe-yaml = { version = "1.6.2", path = "wfe-yaml", registry = "sunbeam" }
|
||||||
wfe-buildkit = { version = "1.6.1", path = "wfe-buildkit", registry = "sunbeam" }
|
wfe-buildkit = { version = "1.6.2", path = "wfe-buildkit", registry = "sunbeam" }
|
||||||
wfe-containerd = { version = "1.6.1", path = "wfe-containerd", registry = "sunbeam" }
|
wfe-containerd = { version = "1.6.2", path = "wfe-containerd", registry = "sunbeam" }
|
||||||
wfe-rustlang = { version = "1.6.1", path = "wfe-rustlang", registry = "sunbeam" }
|
wfe-rustlang = { version = "1.6.2", 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.1", path = "../wfe-buildkit-protos", registry = "sunbeam" }
|
wfe-buildkit-protos = { version = "1.6.2", 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.1", path = "../wfe-containerd-protos", registry = "sunbeam" }
|
wfe-containerd-protos = { version = "1.6.2", 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 }
|
||||||
|
|||||||
@@ -61,8 +61,23 @@ impl<D: WorkflowData> WorkflowBuilder<D> {
|
|||||||
id
|
id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Add a typed step with an optional name and config.
|
||||||
|
/// Convenience for use inside `parallel` branch closures.
|
||||||
|
pub fn add_step_typed<S: StepBody + Default + 'static>(
|
||||||
|
&mut self,
|
||||||
|
name: &str,
|
||||||
|
config: Option<serde_json::Value>,
|
||||||
|
) -> usize {
|
||||||
|
let id = self.add_step(std::any::type_name::<S>());
|
||||||
|
self.steps[id].name = Some(name.to_string());
|
||||||
|
if let Some(cfg) = config {
|
||||||
|
self.steps[id].step_config = Some(cfg);
|
||||||
|
}
|
||||||
|
id
|
||||||
|
}
|
||||||
|
|
||||||
/// Wire an outcome from `from_step` to `to_step`.
|
/// Wire an outcome from `from_step` to `to_step`.
|
||||||
pub(crate) fn wire_outcome(&mut self, from_step: usize, to_step: usize, value: Option<serde_json::Value>) {
|
pub fn wire_outcome(&mut self, from_step: usize, to_step: usize, value: Option<serde_json::Value>) {
|
||||||
if let Some(step) = self.steps.get_mut(from_step) {
|
if let Some(step) = self.steps.get_mut(from_step) {
|
||||||
step.outcomes.push(StepOutcome {
|
step.outcomes.push(StepOutcome {
|
||||||
next_step: to_step,
|
next_step: to_step,
|
||||||
@@ -386,6 +401,34 @@ mod tests {
|
|||||||
assert_eq!(def.steps[0].step_type, def.steps[1].step_type);
|
assert_eq!(def.steps[0].step_type, def.steps[1].step_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn add_step_typed_sets_name_and_config() {
|
||||||
|
let cfg = serde_json::json!({"namespace": "ory"});
|
||||||
|
let mut builder = WorkflowBuilder::<TestData>::new();
|
||||||
|
let id = builder.add_step_typed::<StepA>("apply-ory", Some(cfg.clone()));
|
||||||
|
assert_eq!(builder.steps[id].name, Some("apply-ory".into()));
|
||||||
|
assert_eq!(builder.steps[id].step_config, Some(cfg));
|
||||||
|
assert!(builder.steps[id].step_type.contains("StepA"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn add_step_typed_without_config() {
|
||||||
|
let mut builder = WorkflowBuilder::<TestData>::new();
|
||||||
|
let id = builder.add_step_typed::<StepB>("my-step", None);
|
||||||
|
assert_eq!(builder.steps[id].name, Some("my-step".into()));
|
||||||
|
assert_eq!(builder.steps[id].step_config, None);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn wire_outcome_connects_steps() {
|
||||||
|
let mut builder = WorkflowBuilder::<TestData>::new();
|
||||||
|
let id0 = builder.add_step_typed::<StepA>("first", None);
|
||||||
|
let id1 = builder.add_step_typed::<StepB>("second", None);
|
||||||
|
builder.wire_outcome(id0, id1, None);
|
||||||
|
assert_eq!(builder.steps[id0].outcomes.len(), 1);
|
||||||
|
assert_eq!(builder.steps[id0].outcomes[0].next_step, id1);
|
||||||
|
}
|
||||||
|
|
||||||
#[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 = { version = "1.6.1", path = "../wfe", registry = "sunbeam" }
|
wfe = { version = "1.6.2", path = "../wfe", registry = "sunbeam" }
|
||||||
wfe-yaml = { version = "1.6.1", path = "../wfe-yaml", registry = "sunbeam", features = ["rustlang", "buildkit", "containerd"] }
|
wfe-yaml = { version = "1.6.2", path = "../wfe-yaml", registry = "sunbeam", features = ["rustlang", "buildkit", "containerd"] }
|
||||||
wfe-server-protos = { version = "1.6.1", path = "../wfe-server-protos", registry = "sunbeam" }
|
wfe-server-protos = { version = "1.6.2", 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