mirror of
https://codeberg.org/Toasterson/solstice-ci.git
synced 2026-04-10 13:20:41 +00:00
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:
parent
0b54881558
commit
1b7b2dd91b
5 changed files with 20 additions and 21 deletions
|
|
@ -5,21 +5,21 @@ edition = "2024"
|
|||
|
||||
[dependencies]
|
||||
miette = { version = "7", features = ["fancy"] }
|
||||
thiserror = "1"
|
||||
thiserror = "2"
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
|
||||
opentelemetry = { version = "0.26", features = ["trace"] }
|
||||
opentelemetry_sdk = { version = "0.26", features = ["rt-tokio"] }
|
||||
opentelemetry-otlp = { version = "0.26", features = ["grpc-tonic"] }
|
||||
tracing-opentelemetry = "0.27"
|
||||
opentelemetry = { version = "0.31", features = ["trace"] }
|
||||
opentelemetry_sdk = { version = "0.31", features = ["rt-tokio"] }
|
||||
opentelemetry-otlp = { version = "0.31", features = ["grpc-tonic"] }
|
||||
tracing-opentelemetry = "0.32"
|
||||
tracing-appender = "0.2"
|
||||
atty = "0.2"
|
||||
kdl = "4"
|
||||
kdl = "6"
|
||||
# gRPC/protobuf runtime for Runner API
|
||||
tonic = { version = "0.12", features = ["transport"] }
|
||||
prost = "0.13"
|
||||
# messaging + serialization
|
||||
lapin = { version = "2", default-features = false, features = ["rustls"] }
|
||||
lapin = { version = "3", default-features = false, features = ["rustls"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
uuid = { version = "1", features = ["serde", "v4"] }
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ pub fn parse_workflow_str(s: &str) -> Result<Workflow> {
|
|||
|
||||
let name = wf_node
|
||||
.get("name")
|
||||
.and_then(|e| e.value().as_string())
|
||||
.and_then(|v| v.as_string())
|
||||
.map(|s| s.to_string());
|
||||
|
||||
// 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> {
|
||||
let id = node
|
||||
.get("id")
|
||||
.and_then(|e| e.value().as_string())
|
||||
.and_then(|v| v.as_string())
|
||||
.map(|s| s.to_string())
|
||||
.ok_or_else(|| Report::msg("job missing string `id` property"))?;
|
||||
|
||||
let runs_on = node
|
||||
.get("runs_on")
|
||||
.and_then(|e| e.value().as_string())
|
||||
.and_then(|v| v.as_string())
|
||||
.map(|s| s.to_string());
|
||||
|
||||
let mut steps = Vec::new();
|
||||
|
|
@ -81,13 +81,13 @@ fn parse_job(node: &KdlNode) -> Result<Job> {
|
|||
fn parse_step(node: &KdlNode) -> Result<Step> {
|
||||
let run = node
|
||||
.get("run")
|
||||
.and_then(|e| e.value().as_string())
|
||||
.and_then(|v| v.as_string())
|
||||
.map(|s| s.to_string())
|
||||
.ok_or_else(|| Report::msg("step missing string `run` property"))?;
|
||||
|
||||
let name = node
|
||||
.get("name")
|
||||
.and_then(|e| e.value().as_string())
|
||||
.and_then(|v| v.as_string())
|
||||
.map(|s| s.to_string());
|
||||
|
||||
Ok(Step { name, run })
|
||||
|
|
|
|||
|
|
@ -8,5 +8,4 @@ name = "migration"
|
|||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
sea-orm-migration = { version = "0.12", 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"] }
|
||||
sea-orm-migration = { version = "1.1.17", default-features = false, features = ["runtime-tokio-rustls", "sqlx-postgres", "sqlx-sqlite"] }
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@ libvirt = []
|
|||
common = { path = "../common" }
|
||||
clap = { version = "4", features = ["derive", "env"] }
|
||||
miette = { version = "7", features = ["fancy"] }
|
||||
thiserror = "1"
|
||||
thiserror = "2"
|
||||
tracing = "0.1"
|
||||
tokio = { version = "1", features = ["rt-multi-thread", "macros", "signal", "fs", "io-util"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
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"] }
|
||||
bytes = "1"
|
||||
path-absolutize = "3"
|
||||
|
|
@ -26,9 +26,9 @@ tonic = { version = "0.12", features = ["transport"] }
|
|||
# Compression/decompression
|
||||
zstd = "0.13"
|
||||
# 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" }
|
||||
sea-orm-migration = { version = "0.12" }
|
||||
sea-orm-migration = { version = "1.1.17" }
|
||||
chrono = { version = "0.4", default-features = false, features = ["clock", "std", "serde"] }
|
||||
# Utilities
|
||||
once_cell = "1"
|
||||
|
|
@ -38,4 +38,4 @@ uuid = { version = "1", features = ["v4", "serde"] }
|
|||
futures-util = "0.3.31"
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
virt = { version = "0.3" }
|
||||
virt = { version = "0.4.3" }
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ impl Runner for RunnerSvc {
|
|||
}
|
||||
|
||||
// Publish final status if we have enough context
|
||||
if let (Some(id), Some(repo), Some(sha)) = (req_id, repo_url, commit_sha) {
|
||||
let result = common::messages::JobResult::new(id, repo, sha, success, exit_code, None);
|
||||
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.clone(), repo.clone(), sha.clone(), success, exit_code, None);
|
||||
if let Err(e) = publish_job_result(&self.mq_cfg, &result).await {
|
||||
error!(error = %e, request_id = %id, "failed to publish JobResult");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue