diff --git a/nix/ofborg-carnix.nix b/nix/ofborg-carnix.nix index a7c3e57..88cfa0d 100644 --- a/nix/ofborg-carnix.nix +++ b/nix/ofborg-carnix.nix @@ -45,7 +45,7 @@ let kernel = buildPlatform.parsed.kernel.name; ) [] (builtins.attrNames feat); in rec { - ofborg = f: ofborg_0_1_4 { features = ofborg_0_1_4_features { ofborg_0_1_4 = f; }; }; + ofborg = f: ofborg_0_1_5 { features = ofborg_0_1_5_features { ofborg_0_1_5 = f; }; }; aho_corasick_0_5_3_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { crateName = "aho-corasick"; version = "0.5.3"; @@ -413,9 +413,9 @@ rec { sha256 = "1y6qnd9r8ga6y8mvlabdrr73nc8cshjjlzbvnanzyj9b8zzkfwk2"; inherit dependencies buildDependencies features; }; - ofborg_0_1_4_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + ofborg_0_1_5_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { crateName = "ofborg"; - version = "0.1.4"; + version = "0.1.5"; authors = [ "Graham Christensen " ]; src = include [ "Cargo.toml" "Cargo.lock" "src" "test-srcs" "build.rs" ] ./../ofborg; build = "build.rs"; @@ -1342,10 +1342,10 @@ rec { libc_0_2_36.default = true; num_cpus_1_8_0.default = (f.num_cpus_1_8_0.default or true); }) [ libc_0_2_36_features ]; - ofborg_0_1_4 = { features?(ofborg_0_1_4_features {}) }: ofborg_0_1_4_ { + ofborg_0_1_5 = { features?(ofborg_0_1_5_features {}) }: ofborg_0_1_5_ { dependencies = mapFeatures features ([ amqp_0_1_0 either_1_4_0 env_logger_0_4_3 fs2_0_4_3 hubcaps_0_3_16 hyper_0_10_13 hyper_native_tls_0_2_4 log_0_3_8 lru_cache_0_1_1 md5_0_3_6 serde_1_0_27 serde_derive_1_0_27 serde_json_1_0_9 tempfile_2_2_0 uuid_0_4_0 ]); }; - ofborg_0_1_4_features = f: updateFeatures f (rec { + ofborg_0_1_5_features = f: updateFeatures f (rec { amqp_0_1_0.default = true; either_1_4_0.default = true; env_logger_0_4_3.default = true; @@ -1356,7 +1356,7 @@ rec { log_0_3_8.default = true; lru_cache_0_1_1.default = true; md5_0_3_6.default = true; - ofborg_0_1_4.default = (f.ofborg_0_1_4.default or true); + ofborg_0_1_5.default = (f.ofborg_0_1_5.default or true); serde_1_0_27.default = true; serde_derive_1_0_27.default = true; serde_json_1_0_9.default = true; diff --git a/ofborg/Cargo.lock b/ofborg/Cargo.lock index dc6f1ed..f964a08 100644 --- a/ofborg/Cargo.lock +++ b/ofborg/Cargo.lock @@ -379,7 +379,7 @@ dependencies = [ [[package]] name = "ofborg" -version = "0.1.4" +version = "0.1.5" dependencies = [ "amqp 0.1.0 (git+https://github.com/grahamc/rust-amqp.git)", "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/ofborg/Cargo.toml b/ofborg/Cargo.toml index 628219f..90a8723 100644 --- a/ofborg/Cargo.toml +++ b/ofborg/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ofborg" -version = "0.1.4" +version = "0.1.5" authors = ["Graham Christensen "] include = ["Cargo.toml", "Cargo.lock", "src", "test-srcs", "build.rs"] build = "build.rs" diff --git a/ofborg/src/bin/build-faker.rs b/ofborg/src/bin/build-faker.rs index 7752db4..b47ecca 100644 --- a/ofborg/src/bin/build-faker.rs +++ b/ofborg/src/bin/build-faker.rs @@ -53,6 +53,7 @@ fn main() { attrs: vec!["success".to_owned()], logs: Some((Some("logs".to_owned()), Some(logbackrk.to_lowercase()))), statusreport: Some((None, Some("scratch".to_owned()))), + request_id: "bogus-request-id".to_owned(), }; { diff --git a/ofborg/src/bin/log-message-generator.rs b/ofborg/src/bin/log-message-generator.rs index dff3dd1..ae5d792 100644 --- a/ofborg/src/bin/log-message-generator.rs +++ b/ofborg/src/bin/log-message-generator.rs @@ -44,6 +44,7 @@ fn main() { Some(String::from("build.log")), )), statusreport: Some((Some(String::from("build-results")), None)), + request_id: "bogus-request-id".to_owned(), }; loop { diff --git a/ofborg/src/message/buildjob.rs b/ofborg/src/message/buildjob.rs index 8f5ea41..20e7bcc 100644 --- a/ofborg/src/message/buildjob.rs +++ b/ofborg/src/message/buildjob.rs @@ -8,6 +8,7 @@ pub struct BuildJob { pub pr: Pr, pub subset: Option, pub attrs: Vec, + pub request_id: String, pub logs: Option, // (Exchange, Routing Key) pub statusreport: Option, // (Exchange, Routing Key) } @@ -24,6 +25,7 @@ impl BuildJob { attrs: Vec, logs: Option, statusreport: Option, + request_id: String, ) -> BuildJob { let logbackrk = format!( @@ -41,6 +43,7 @@ impl BuildJob { statusreport: Some(statusreport.unwrap_or( (Some("build-results".to_owned()), None), )), + request_id: request_id, } } } diff --git a/ofborg/src/message/buildresult.rs b/ofborg/src/message/buildresult.rs index b00e3ea..ad024b3 100644 --- a/ofborg/src/message/buildresult.rs +++ b/ofborg/src/message/buildresult.rs @@ -7,6 +7,7 @@ pub struct BuildResult { pub system: String, pub output: Vec, pub attempt_id: String, + pub request_id: Option, pub success: Option, pub skipped_attrs: Option>, pub attempted_attrs: Option>, diff --git a/ofborg/src/tasks/build.rs b/ofborg/src/tasks/build.rs index 62eeaea..5b2f2f6 100644 --- a/ofborg/src/tasks/build.rs +++ b/ofborg/src/tasks/build.rs @@ -119,6 +119,7 @@ impl<'a, 'b> JobActions<'a, 'b> { system: self.system.clone(), output: vec![String::from("Merge failed")], attempt_id: self.attempt_id.clone(), + request_id: Some(self.job.request_id.clone()), attempted_attrs: None, skipped_attrs: None, success: Some(false), @@ -201,6 +202,7 @@ impl<'a, 'b> JobActions<'a, 'b> { system: self.system.clone(), output: self.log_snippet(), attempt_id: self.attempt_id.clone(), + request_id: Some(self.job.request_id.clone()), skipped_attrs: Some(not_attempted_attrs), attempted_attrs: None, success: None, @@ -236,6 +238,7 @@ impl<'a, 'b> JobActions<'a, 'b> { system: self.system.clone(), output: self.log_snippet(), attempt_id: self.attempt_id.clone(), + request_id: Some(self.job.request_id.clone()), success: Some(success), attempted_attrs: Some(attempted_attrs), skipped_attrs: Some(not_attempted_attrs), @@ -492,6 +495,7 @@ mod tests { Some(String::from("build.log")), )), statusreport: Some((Some(String::from("build-results")), None)), + request_id: "bogus-request-id".to_owned(), }; let mut dummyreceiver = notifyworker::DummyNotificationReceiver::new(); @@ -540,6 +544,7 @@ mod tests { Some(String::from("build.log")), )), statusreport: Some((Some(String::from("build-results")), None)), + request_id: "bogus-request-id".to_owned(), }; let mut dummyreceiver = notifyworker::DummyNotificationReceiver::new(); diff --git a/ofborg/src/tasks/githubcommentfilter.rs b/ofborg/src/tasks/githubcommentfilter.rs index 3c8e1f0..06f5035 100644 --- a/ofborg/src/tasks/githubcommentfilter.rs +++ b/ofborg/src/tasks/githubcommentfilter.rs @@ -1,6 +1,8 @@ extern crate amqp; extern crate env_logger; +extern crate uuid; +use uuid::Uuid; use ofborg::ghevent; use ofborg::acl; use serde_json; @@ -115,6 +117,7 @@ impl worker::SimpleWorker for GitHubCommentWorker { attrs, None, None, + format!("{}", Uuid::new_v4()), ); for (exch, rk) in build_destinations.clone() { diff --git a/ofborg/src/tasks/githubcommentposter.rs b/ofborg/src/tasks/githubcommentposter.rs index ef50b67..27201b2 100644 --- a/ofborg/src/tasks/githubcommentposter.rs +++ b/ofborg/src/tasks/githubcommentposter.rs @@ -181,6 +181,7 @@ mod tests { "/nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29-gdb-8.1".to_owned(), ], attempt_id: "neatattemptid".to_owned(), + request_id: Some("bogus-request-id".to_owned()), system: "x86_64-linux".to_owned(), attempted_attrs: Some(vec!["foo".to_owned()]), skipped_attrs: Some(vec!["bar".to_owned()]), @@ -242,6 +243,7 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29 "/nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29-gdb-8.1".to_owned(), ], attempt_id: "neatattemptid".to_owned(), + request_id: Some("bogus-request-id".to_owned()), system: "x86_64-linux".to_owned(), attempted_attrs: Some(vec!["foo".to_owned()]), skipped_attrs: None, @@ -302,6 +304,7 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29 "/nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29-gdb-8.1".to_owned(), ], attempt_id: "neatattemptid".to_owned(), + request_id: Some("bogus-request-id".to_owned()), system: "x86_64-linux".to_owned(), attempted_attrs: None, skipped_attrs: None, @@ -359,6 +362,7 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29 "/nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29-gdb-8.1".to_owned(), ], attempt_id: "neatattemptid".to_owned(), + request_id: Some("bogus-request-id".to_owned()), system: "x86_64-linux".to_owned(), attempted_attrs: None, skipped_attrs: None, @@ -405,6 +409,7 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29 }, output: vec!["foo".to_owned()], attempt_id: "foo".to_owned(), + request_id: Some("bogus-request-id".to_owned()), system: "x86_64-linux".to_owned(), attempted_attrs: None, skipped_attrs: Some(vec!["not-attempted".to_owned()]), @@ -444,6 +449,7 @@ foo }, output: vec![], attempt_id: "foo".to_owned(), + request_id: Some("bogus-request-id".to_owned()), system: "x86_64-linux".to_owned(), attempted_attrs: None, skipped_attrs: Some(vec!["not-attempted".to_owned()]), diff --git a/ofborg/src/tasks/log_message_collector.rs b/ofborg/src/tasks/log_message_collector.rs index d115899..4dc2bb9 100644 --- a/ofborg/src/tasks/log_message_collector.rs +++ b/ofborg/src/tasks/log_message_collector.rs @@ -444,6 +444,7 @@ mod tests { system: "x86_64-linux".to_owned(), output: vec![], attempt_id: "attempt-id-foo".to_owned(), + request_id: Some("bogus-request-id".to_owned()), success: Some(true), attempted_attrs: Some(vec!["foo".to_owned()]), skipped_attrs: Some(vec!["bar".to_owned()]), @@ -477,6 +478,6 @@ mod tests { let mut s = String::new(); pr.push("routing-key-foo/attempt-id-foo.result.json"); File::open(pr).unwrap().read_to_string(&mut s).unwrap(); - assert_eq!(&s, "{\"repo\":{\"owner\":\"NixOS\",\"name\":\"ofborg\",\"full_name\":\"NixOS/ofborg\",\"clone_url\":\"https://github.com/nixos/ofborg.git\"},\"pr\":{\"target_branch\":\"scratch\",\"number\":42,\"head_sha\":\"6dd9f0265d52b946dd13daf996f30b64e4edb446\"},\"system\":\"x86_64-linux\",\"output\":[],\"attempt_id\":\"attempt-id-foo\",\"success\":true,\"skipped_attrs\":[\"bar\"],\"attempted_attrs\":[\"foo\"]}"); + assert_eq!(&s, "{\"repo\":{\"owner\":\"NixOS\",\"name\":\"ofborg\",\"full_name\":\"NixOS/ofborg\",\"clone_url\":\"https://github.com/nixos/ofborg.git\"},\"pr\":{\"target_branch\":\"scratch\",\"number\":42,\"head_sha\":\"6dd9f0265d52b946dd13daf996f30b64e4edb446\"},\"system\":\"x86_64-linux\",\"output\":[],\"attempt_id\":\"attempt-id-foo\",\"request_id\":\"bogus-request-id\",\"success\":true,\"skipped_attrs\":[\"bar\"],\"attempted_attrs\":[\"foo\"]}"); } } diff --git a/ofborg/src/tasks/massrebuilder.rs b/ofborg/src/tasks/massrebuilder.rs index cae6164..bd8743a 100644 --- a/ofborg/src/tasks/massrebuilder.rs +++ b/ofborg/src/tasks/massrebuilder.rs @@ -1,6 +1,8 @@ extern crate amqp; extern crate env_logger; +extern crate uuid; +use uuid::Uuid; use std::collections::HashMap; use std::fs::File; use std::io::Read; @@ -454,6 +456,7 @@ impl worker::SimpleWorker for MassRebuildWorker