Merge pull request #622 from Artturin/updates2

This commit is contained in:
Cole Helbling 2022-11-13 07:56:19 -08:00 committed by GitHub
commit d56502e692
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 1061 additions and 666 deletions

1645
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -7,4 +7,4 @@ edition = "2018"
[dependencies]
ofborg = { path = "../ofborg" }
log = "0.3.8"
log = "0.4.17"

View file

@ -1,4 +1,3 @@
#[macro_use]
extern crate log;
use std::env;

View file

@ -6,26 +6,28 @@ build = "build.rs"
edition = "2018"
[dependencies]
async-std = { version = "=1.6.0", features = ["unstable"] }
chrono = "0.4.6"
either = "1.4.0"
fs2 = "0.4.2"
futures-util = "0.3.21"
async-std = { version = "=1.12.0", features = ["unstable"] }
chrono = "0.4.22"
either = "1.8.0"
fs2 = "0.4.3"
futures-util = "0.3.25"
hubcaps = { git = "https://github.com/grahamc/hubcaps.git" }
#hubcaps = { path = "../../../grahamc/hubcaps/" } # for testing patches
hyper = "0.10.*"
# to upgrade hyper, hubcaps has to be updated too
# newer hyper has hyper::StatusCode while hubcaps returns a hyper::status::StatusCode
hyper = "=0.10.*"
hyper-native-tls = "0.3.0"
lapin = "1.0.0"
lru-cache = "0.1.1"
md5 = "0.3.5"
nom = "4.0.0-beta3"
regex = "1.5.4"
lapin = "2.1.1"
lru-cache = "0.1.2"
md5 = "0.7.0"
nom = "4.2.3"
regex = "1.7.0"
separator = "0.4.1"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
sys-info = "0.5.6"
tempfile = "2.2.0"
tracing = "0.1.13"
tracing-subscriber = { version = "0.2.5", features = ["json"] }
uuid = { version = "0.4", features = ["v4"] }
sys-info = "0.9.1"
tempfile = "3.3.0"
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.16", features = ["json", "env-filter"] }
uuid = { version = "1.2", features = ["v4"] }

View file

@ -182,7 +182,7 @@ impl Metric {
}
fn events() -> Vec<MetricType> {
return vec![
vec![
Metric::ticker(
"StatCollectorLegacyEvent",
"Number of received legacy events",
@ -346,7 +346,7 @@ fn events() -> Vec<MetricType> {
None
),
*/
];
]
}
fn main() {

View file

@ -64,14 +64,14 @@ pub fn parse_line(text: &str) -> Option<Vec<Instruction>> {
}
}
#[derive(PartialEq, Debug)]
#[derive(PartialEq, Eq, Debug)]
pub enum Instruction {
Build(Subset, Vec<String>),
Eval,
}
#[allow(clippy::upper_case_acronyms)]
#[derive(Serialize, Deserialize, Debug, PartialEq)]
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
pub enum Subset {
Nixpkgs,
NixOS,

View file

@ -96,8 +96,7 @@ impl<'a, W: SimpleWorker + 'a> ConsumerExt<'a, W> for Channel {
FieldTable::default(),
))?;
Ok(Box::pin(async move {
while let Some(Ok(item)) = consumer.next().await {
let (_channel, deliver) = item;
while let Some(Ok(deliver)) = consumer.next().await {
debug!(?deliver.delivery_tag, "consumed delivery");
let content_type = deliver.properties.content_type();
let job = worker
@ -170,8 +169,7 @@ impl<'a, W: SimpleNotifyWorker + 'a + Send> ConsumerExt<'a, W> for NotifyChannel
))?;
let mut chan = self.0;
Ok(Box::pin(async move {
while let Some(Ok(item)) = consumer.next().await {
let (_channel, deliver) = item;
while let Some(Ok(deliver)) = consumer.next().await {
debug!(?deliver.delivery_tag, "consumed delivery");
let mut receiver = ChannelNotificationReceiver {
channel: &mut chan,
@ -234,7 +232,7 @@ async fn action_deliver(
&exch,
&key,
BasicPublishOptions::default(),
msg.content,
&msg.content,
props,
)
.await?

View file

@ -8,7 +8,7 @@ pub struct IssueComment {
pub issue: Issue,
}
#[derive(Serialize, Deserialize, Debug, PartialEq)]
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum IssueCommentAction {
Created,

View file

@ -21,19 +21,19 @@ pub struct BaseChange {
pub sha: ChangeWas,
}
#[derive(Serialize, Deserialize, Debug, PartialEq)]
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
pub struct ChangeWas {
pub from: String,
}
#[derive(Serialize, Deserialize, Debug, PartialEq)]
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum PullRequestState {
Open,
Closed,
}
#[derive(Serialize, Deserialize, Debug, PartialEq)]
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum PullRequestAction {
Edited,

View file

@ -2,7 +2,7 @@ use crate::message::{Pr, Repo};
use hubcaps::checks::Conclusion;
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
pub enum BuildStatus {
Skipped,
Success,

View file

@ -14,7 +14,7 @@ use std::process::{Command, Stdio};
use tempfile::tempfile;
#[allow(clippy::upper_case_acronyms)]
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum File {
DefaultNixpkgs,
ReleaseNixOS,
@ -95,7 +95,7 @@ impl fmt::Display for Operation {
}
}
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Nix {
pub system: String,
remote: String,
@ -348,8 +348,7 @@ impl Nix {
fn lines_from_file(file: fs::File) -> Vec<String> {
BufReader::new(file)
.lines()
.filter(|line| line.is_ok())
.map(|line| line.unwrap())
.filter_map(|line| line.ok())
.filter(|msg| !is_user_setting_warning(msg))
.collect()
}

View file

@ -43,7 +43,7 @@ impl SysEvents for RabbitMq<lapin::Channel> {
&String::from("stats"),
"",
BasicPublishOptions::default(),
serde_json::to_string(&EventMessage {
&serde_json::to_string(&EventMessage {
sender: self.identity.clone(),
events: vec![event],
})

View file

@ -16,7 +16,7 @@ pub enum System {
X8664Linux,
}
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub struct Stdenvs {
nix: nix::Nix,
co: PathBuf,

View file

@ -91,10 +91,10 @@ impl worker::SimpleWorker for EvaluationFilterWorker {
pr: pr_msg,
};
return vec![
vec![
worker::publish_serde_action(None, Some("mass-rebuild-check-jobs".to_owned()), &msg),
worker::Action::Ack,
];
]
}
}

View file

@ -6,7 +6,7 @@ pub struct Response {}
pub type Actions = Vec<Action>;
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub enum Action {
Ack,
NackRequeue,
@ -14,7 +14,7 @@ pub enum Action {
Publish(Box<QueueMsg>),
}
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub struct QueueMsg {
pub exchange: Option<String>,
pub routing_key: Option<String>,