Update parsing logic and upgrade dependencies across crates

This commit updates parsing logic by simplifying `.and_then(|e| e.value().as_string())` calls to `.and_then(|v| v.as_string())`. Additionally, it upgrades several crate dependencies, including `thiserror`, `sea-orm`, `lapin`, `virt`, and `kdl`, to their latest compatible versions for improved functionality and stability.
This commit is contained in:
Till Wegmueller 2025-11-01 14:44:16 +01:00
parent 0b54881558
commit 1b7b2dd91b
No known key found for this signature in database
5 changed files with 20 additions and 21 deletions

View file

@ -5,21 +5,21 @@ edition = "2024"
[dependencies] [dependencies]
miette = { version = "7", features = ["fancy"] } miette = { version = "7", features = ["fancy"] }
thiserror = "1" thiserror = "2"
tracing = "0.1" tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] } tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
opentelemetry = { version = "0.26", features = ["trace"] } opentelemetry = { version = "0.31", features = ["trace"] }
opentelemetry_sdk = { version = "0.26", features = ["rt-tokio"] } opentelemetry_sdk = { version = "0.31", features = ["rt-tokio"] }
opentelemetry-otlp = { version = "0.26", features = ["grpc-tonic"] } opentelemetry-otlp = { version = "0.31", features = ["grpc-tonic"] }
tracing-opentelemetry = "0.27" tracing-opentelemetry = "0.32"
tracing-appender = "0.2" tracing-appender = "0.2"
atty = "0.2" atty = "0.2"
kdl = "4" kdl = "6"
# gRPC/protobuf runtime for Runner API # gRPC/protobuf runtime for Runner API
tonic = { version = "0.12", features = ["transport"] } tonic = { version = "0.12", features = ["transport"] }
prost = "0.13" prost = "0.13"
# messaging + serialization # messaging + serialization
lapin = { version = "2", default-features = false, features = ["rustls"] } lapin = { version = "3", default-features = false, features = ["rustls"] }
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_json = "1" serde_json = "1"
uuid = { version = "1", features = ["serde", "v4"] } uuid = { version = "1", features = ["serde", "v4"] }

View file

@ -37,7 +37,7 @@ pub fn parse_workflow_str(s: &str) -> Result<Workflow> {
let name = wf_node let name = wf_node
.get("name") .get("name")
.and_then(|e| e.value().as_string()) .and_then(|v| v.as_string())
.map(|s| s.to_string()); .map(|s| s.to_string());
// Child nodes are within the workflow node body // Child nodes are within the workflow node body
@ -57,13 +57,13 @@ pub fn parse_workflow_str(s: &str) -> Result<Workflow> {
fn parse_job(node: &KdlNode) -> Result<Job> { fn parse_job(node: &KdlNode) -> Result<Job> {
let id = node let id = node
.get("id") .get("id")
.and_then(|e| e.value().as_string()) .and_then(|v| v.as_string())
.map(|s| s.to_string()) .map(|s| s.to_string())
.ok_or_else(|| Report::msg("job missing string `id` property"))?; .ok_or_else(|| Report::msg("job missing string `id` property"))?;
let runs_on = node let runs_on = node
.get("runs_on") .get("runs_on")
.and_then(|e| e.value().as_string()) .and_then(|v| v.as_string())
.map(|s| s.to_string()); .map(|s| s.to_string());
let mut steps = Vec::new(); let mut steps = Vec::new();
@ -81,13 +81,13 @@ fn parse_job(node: &KdlNode) -> Result<Job> {
fn parse_step(node: &KdlNode) -> Result<Step> { fn parse_step(node: &KdlNode) -> Result<Step> {
let run = node let run = node
.get("run") .get("run")
.and_then(|e| e.value().as_string()) .and_then(|v| v.as_string())
.map(|s| s.to_string()) .map(|s| s.to_string())
.ok_or_else(|| Report::msg("step missing string `run` property"))?; .ok_or_else(|| Report::msg("step missing string `run` property"))?;
let name = node let name = node
.get("name") .get("name")
.and_then(|e| e.value().as_string()) .and_then(|v| v.as_string())
.map(|s| s.to_string()); .map(|s| s.to_string());
Ok(Step { name, run }) Ok(Step { name, run })

View file

@ -8,5 +8,4 @@ name = "migration"
path = "src/lib.rs" path = "src/lib.rs"
[dependencies] [dependencies]
sea-orm-migration = { version = "0.12", default-features = false, features = ["runtime-tokio-rustls", "sqlx-postgres", "sqlx-sqlite"] } sea-orm-migration = { version = "1.1.17", default-features = false, features = ["runtime-tokio-rustls", "sqlx-postgres", "sqlx-sqlite"] }
sea-orm = { version = "0.12", default-features = false, features = ["sqlx-postgres", "sqlx-sqlite", "runtime-tokio-rustls"] }

View file

@ -11,13 +11,13 @@ libvirt = []
common = { path = "../common" } common = { path = "../common" }
clap = { version = "4", features = ["derive", "env"] } clap = { version = "4", features = ["derive", "env"] }
miette = { version = "7", features = ["fancy"] } miette = { version = "7", features = ["fancy"] }
thiserror = "1" thiserror = "2"
tracing = "0.1" tracing = "0.1"
tokio = { version = "1", features = ["rt-multi-thread", "macros", "signal", "fs", "io-util"] } tokio = { version = "1", features = ["rt-multi-thread", "macros", "signal", "fs", "io-util"] }
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_json = "1" serde_json = "1"
serde_yaml = "0.9" serde_yaml = "0.9"
config = { version = "0.14", default-features = false, features = ["yaml"] } config = { version = "0.15", default-features = false, features = ["yaml"] }
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls-native-roots", "http2", "gzip", "brotli", "zstd"] } reqwest = { version = "0.12", default-features = false, features = ["rustls-tls-native-roots", "http2", "gzip", "brotli", "zstd"] }
bytes = "1" bytes = "1"
path-absolutize = "3" path-absolutize = "3"
@ -26,9 +26,9 @@ tonic = { version = "0.12", features = ["transport"] }
# Compression/decompression # Compression/decompression
zstd = "0.13" zstd = "0.13"
# DB (optional basic persistence) # DB (optional basic persistence)
sea-orm = { version = "0.12", default-features = false, features = ["sqlx-postgres", "sqlx-sqlite", "runtime-tokio-rustls", "macros", "with-uuid", "with-chrono" ] } sea-orm = { version = "1.1.17", default-features = false, features = ["sqlx-postgres", "sqlx-sqlite", "runtime-tokio-rustls", "macros", "with-uuid", "with-chrono" ] }
migration = { path = "../migration" } migration = { path = "../migration" }
sea-orm-migration = { version = "0.12" } sea-orm-migration = { version = "1.1.17" }
chrono = { version = "0.4", default-features = false, features = ["clock", "std", "serde"] } chrono = { version = "0.4", default-features = false, features = ["clock", "std", "serde"] }
# Utilities # Utilities
once_cell = "1" once_cell = "1"
@ -38,4 +38,4 @@ uuid = { version = "1", features = ["v4", "serde"] }
futures-util = "0.3.31" futures-util = "0.3.31"
[target.'cfg(target_os = "linux")'.dependencies] [target.'cfg(target_os = "linux")'.dependencies]
virt = { version = "0.3" } virt = { version = "0.4.3" }

View file

@ -58,8 +58,8 @@ impl Runner for RunnerSvc {
} }
// Publish final status if we have enough context // Publish final status if we have enough context
if let (Some(id), Some(repo), Some(sha)) = (req_id, repo_url, commit_sha) { if let (Some(id), Some(repo), Some(sha)) = (req_id.as_ref(), repo_url.as_ref(), commit_sha.as_ref()) {
let result = common::messages::JobResult::new(id, repo, sha, success, exit_code, None); let result = common::messages::JobResult::new(id.clone(), repo.clone(), sha.clone(), success, exit_code, None);
if let Err(e) = publish_job_result(&self.mq_cfg, &result).await { if let Err(e) = publish_job_result(&self.mq_cfg, &result).await {
error!(error = %e, request_id = %id, "failed to publish JobResult"); error!(error = %e, request_id = %id, "failed to publish JobResult");
} }