Merge pull request #215 from NixOS/tagged-comments

Tagged comments
This commit is contained in:
Graham Christensen 2018-08-31 16:32:16 -04:00 committed by GitHub
commit c2ddaf91d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 22 deletions

View file

@ -17,7 +17,7 @@ pub struct BuildResult {
pub system: String,
pub output: Vec<String>,
pub attempt_id: String,
pub request_id: Option<String>,
pub request_id: String,
pub success: Option<bool>, // replaced by status
pub status: Option<BuildStatus>,
pub skipped_attrs: Option<Vec<String>>,

View file

@ -118,7 +118,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()),
request_id: self.job.request_id.clone(),
attempted_attrs: None,
skipped_attrs: None,
status: Some(BuildStatus::Failure),
@ -202,7 +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()),
request_id: self.job.request_id.clone(),
skipped_attrs: Some(not_attempted_attrs),
attempted_attrs: None,
status: None,
@ -243,7 +243,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()),
request_id: self.job.request_id.clone(),
status: Some(status),
success: Some(success),
attempted_attrs: Some(attempted_attrs),

View file

@ -99,7 +99,8 @@ fn result_to_comment(result: &BuildResult) -> String {
};
reply.push(format!(
"{} on {}{}",
"<!--REQUEST_ID={}-->{} on {}{}",
result.request_id,
(match *status {
BuildStatus::Skipped => "No attempt".into(),
BuildStatus::Success => "Success".into(),
@ -195,7 +196,7 @@ mod tests {
"/nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29-gdb-8.1".to_owned(),
],
attempt_id: "neatattemptid".to_owned(),
request_id: Some("bogus-request-id".to_owned()),
request_id: "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()]),
@ -205,7 +206,7 @@ mod tests {
assert_eq!(
&result_to_comment(&result),
"Success on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
"<!--REQUEST_ID=bogus-request-id-->Success on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
Attempted: foo
@ -258,7 +259,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()),
request_id: "bogus-request-id".to_owned(),
system: "x86_64-linux".to_owned(),
attempted_attrs: Some(vec!["foo".to_owned()]),
skipped_attrs: None,
@ -268,7 +269,7 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29
assert_eq!(
&result_to_comment(&result),
"Failure on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
"<!--REQUEST_ID=bogus-request-id-->Failure on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
Attempted: foo
@ -318,7 +319,7 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29
"error: build of '/nix/store/l1limh50lx2cx45yb2gqpv7k8xl1mik2-gdb-8.1.drv' failed".to_owned(),
],
attempt_id: "neatattemptid".to_owned(),
request_id: Some("bogus-request-id".to_owned()),
request_id: "bogus-request-id".to_owned(),
system: "x86_64-linux".to_owned(),
attempted_attrs: Some(vec!["foo".to_owned()]),
skipped_attrs: None,
@ -328,7 +329,7 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29
assert_eq!(
&result_to_comment(&result),
"Timed out, unknown build status on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
"<!--REQUEST_ID=bogus-request-id-->Timed out, unknown build status on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
Attempted: foo
@ -378,7 +379,7 @@ error: build of '/nix/store/l1limh50lx2cx45yb2gqpv7k8xl1mik2-gdb-8.1.drv' failed
"/nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29-gdb-8.1".to_owned(),
],
attempt_id: "neatattemptid".to_owned(),
request_id: Some("bogus-request-id".to_owned()),
request_id: "bogus-request-id".to_owned(),
system: "x86_64-linux".to_owned(),
attempted_attrs: None,
skipped_attrs: None,
@ -388,7 +389,7 @@ error: build of '/nix/store/l1limh50lx2cx45yb2gqpv7k8xl1mik2-gdb-8.1.drv' failed
assert_eq!(
&result_to_comment(&result),
"Success on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
"<!--REQUEST_ID=bogus-request-id-->Success on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
<details><summary>Partial log (click to expand)</summary><p>
@ -437,7 +438,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()),
request_id: "bogus-request-id".to_owned(),
system: "x86_64-linux".to_owned(),
attempted_attrs: None,
skipped_attrs: None,
@ -447,7 +448,7 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29
assert_eq!(
&result_to_comment(&result),
"Failure on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
"<!--REQUEST_ID=bogus-request-id-->Failure on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
<details><summary>Partial log (click to expand)</summary><p>
@ -485,7 +486,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()),
request_id: "bogus-request-id".to_owned(),
system: "x86_64-linux".to_owned(),
attempted_attrs: None,
skipped_attrs: Some(vec!["not-attempted".to_owned()]),
@ -495,7 +496,7 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29
assert_eq!(
&result_to_comment(&result),
"No attempt on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=foo)
"<!--REQUEST_ID=bogus-request-id-->No attempt on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=foo)
The following builds were skipped because they don't evaluate on x86_64-linux: not-attempted
@ -526,7 +527,7 @@ foo
},
output: vec![],
attempt_id: "foo".to_owned(),
request_id: Some("bogus-request-id".to_owned()),
request_id: "bogus-request-id".to_owned(),
system: "x86_64-linux".to_owned(),
attempted_attrs: None,
skipped_attrs: Some(vec!["not-attempted".to_owned()]),
@ -536,7 +537,7 @@ foo
assert_eq!(
&result_to_comment(&result),
"No attempt on x86_64-linux
"<!--REQUEST_ID=bogus-request-id-->No attempt on x86_64-linux
The following builds were skipped because they don't evaluate on x86_64-linux: not-attempted
@ -572,7 +573,7 @@ No partial log is available.
"/nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29-gdb-8.1".to_owned(),
],
attempt_id: "neatattemptid".to_owned(),
request_id: Some("bogus-request-id".to_owned()),
request_id: "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()]),
@ -582,7 +583,7 @@ No partial log is available.
assert_eq!(
&result_to_comment(&result),
"Success on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
"<!--REQUEST_ID=bogus-request-id-->Success on x86_64-linux [(full log)](https://logs.nix.ci/?key=nixos/nixpkgs.2345&attempt_id=neatattemptid)
Attempted: foo

View file

@ -445,7 +445,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()),
request_id: "bogus-request-id".to_owned(),
status: Some(BuildStatus::Success),
success: Some(true),
attempted_attrs: Some(vec!["foo".to_owned()]),