Merge pull request #136 from NixOS/request-id
Pass a request-id along with build jobs and results
This commit is contained in:
commit
022e2090d0
|
@ -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 <graham@grahamc.com>" ];
|
||||
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;
|
||||
|
|
2
ofborg/Cargo.lock
generated
2
ofborg/Cargo.lock
generated
|
@ -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)",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "ofborg"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
authors = ["Graham Christensen <graham@grahamc.com>"]
|
||||
include = ["Cargo.toml", "Cargo.lock", "src", "test-srcs", "build.rs"]
|
||||
build = "build.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(),
|
||||
};
|
||||
|
||||
{
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -8,6 +8,7 @@ pub struct BuildJob {
|
|||
pub pr: Pr,
|
||||
pub subset: Option<Subset>,
|
||||
pub attrs: Vec<String>,
|
||||
pub request_id: String,
|
||||
pub logs: Option<ExchangeQueue>, // (Exchange, Routing Key)
|
||||
pub statusreport: Option<ExchangeQueue>, // (Exchange, Routing Key)
|
||||
}
|
||||
|
@ -24,6 +25,7 @@ impl BuildJob {
|
|||
attrs: Vec<String>,
|
||||
logs: Option<ExchangeQueue>,
|
||||
statusreport: Option<ExchangeQueue>,
|
||||
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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ pub struct BuildResult {
|
|||
pub system: String,
|
||||
pub output: Vec<String>,
|
||||
pub attempt_id: String,
|
||||
pub request_id: Option<String>,
|
||||
pub success: Option<bool>,
|
||||
pub skipped_attrs: Option<Vec<String>>,
|
||||
pub attempted_attrs: Option<Vec<String>>,
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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()]),
|
||||
|
|
|
@ -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\"]}");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<E: stats::SysEvents + 'static> worker::SimpleWorker for MassRebuildWorker<E
|
|||
try_build,
|
||||
None,
|
||||
None,
|
||||
format!("{}", Uuid::new_v4()),
|
||||
);
|
||||
for (dest, rk) in auto_schedule_build_archs {
|
||||
response.push(worker::publish_serde_action(dest, rk, &msg));
|
||||
|
|
Loading…
Reference in a new issue