From e9b6e9932806a923564acbe792f491f72bc0fc7e Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Wed, 30 Oct 2024 00:32:27 +0100 Subject: [PATCH] feat: remove github binaries Signed-off-by: Raito Bezarius --- ofborg/src/bin/github-comment-filter.rs | 78 ------------------------- ofborg/src/bin/github-comment-poster.rs | 66 --------------------- 2 files changed, 144 deletions(-) delete mode 100644 ofborg/src/bin/github-comment-filter.rs delete mode 100644 ofborg/src/bin/github-comment-poster.rs diff --git a/ofborg/src/bin/github-comment-filter.rs b/ofborg/src/bin/github-comment-filter.rs deleted file mode 100644 index acee59b..0000000 --- a/ofborg/src/bin/github-comment-filter.rs +++ /dev/null @@ -1,78 +0,0 @@ -use std::env; -use std::error::Error; - -use async_std::task; -use tracing::info; - -use ofborg::config; -use ofborg::easyamqp::{self, ChannelExt, ConsumerExt}; -use ofborg::easylapin; -use ofborg::tasks; - -fn main() -> Result<(), Box> { - ofborg::setup_log(); - - let arg = env::args() - .nth(1) - .expect("usage: github-comment-filter "); - let cfg = config::load(arg.as_ref()); - - let conn = easylapin::from_config(&cfg.rabbitmq)?; - let mut chan = task::block_on(conn.create_channel())?; - - chan.declare_exchange(easyamqp::ExchangeConfig { - exchange: "github-events".to_owned(), - exchange_type: easyamqp::ExchangeType::Topic, - passive: false, - durable: true, - auto_delete: false, - no_wait: false, - internal: false, - })?; - - chan.declare_exchange(easyamqp::ExchangeConfig { - exchange: "build-jobs".to_owned(), - exchange_type: easyamqp::ExchangeType::Fanout, - passive: false, - durable: true, - auto_delete: false, - no_wait: false, - internal: false, - })?; - - let queue_name = "build-inputs"; - chan.declare_queue(easyamqp::QueueConfig { - queue: queue_name.to_owned(), - passive: false, - durable: true, - exclusive: false, - auto_delete: false, - no_wait: false, - })?; - - chan.bind_queue(easyamqp::BindQueueConfig { - queue: "build-inputs".to_owned(), - exchange: "github-events".to_owned(), - routing_key: Some("issue_comment.*".to_owned()), - no_wait: false, - })?; - - let handle = easylapin::WorkerChannel(chan).consume( - tasks::githubcommentfilter::GitHubCommentWorker::new(cfg.acl(), cfg.github()), - easyamqp::ConsumeConfig { - queue: "build-inputs".to_owned(), - consumer_tag: format!("{}-github-comment-filter", cfg.whoami()), - no_local: false, - no_ack: false, - no_wait: false, - exclusive: false, - }, - )?; - - info!("Fetching jobs from {}", &queue_name); - task::block_on(handle); - - drop(conn); // Close connection. - info!("Closed the session... EOF"); - Ok(()) -} diff --git a/ofborg/src/bin/github-comment-poster.rs b/ofborg/src/bin/github-comment-poster.rs deleted file mode 100644 index 0521db2..0000000 --- a/ofborg/src/bin/github-comment-poster.rs +++ /dev/null @@ -1,66 +0,0 @@ -use std::env; -use std::error::Error; - -use async_std::task; -use tracing::info; - -use ofborg::config; -use ofborg::easyamqp::{self, ChannelExt, ConsumerExt}; -use ofborg::easylapin; -use ofborg::tasks; - -fn main() -> Result<(), Box> { - ofborg::setup_log(); - - let arg = env::args() - .nth(1) - .expect("usage: github-comment-poster "); - let cfg = config::load(arg.as_ref()); - - let conn = easylapin::from_config(&cfg.rabbitmq)?; - let mut chan = task::block_on(conn.create_channel())?; - - chan.declare_exchange(easyamqp::ExchangeConfig { - exchange: "build-results".to_owned(), - exchange_type: easyamqp::ExchangeType::Fanout, - passive: false, - durable: true, - auto_delete: false, - no_wait: false, - internal: false, - })?; - - chan.declare_queue(easyamqp::QueueConfig { - queue: "build-results".to_owned(), - passive: false, - durable: true, - exclusive: false, - auto_delete: false, - no_wait: false, - })?; - - chan.bind_queue(easyamqp::BindQueueConfig { - queue: "build-results".to_owned(), - exchange: "build-results".to_owned(), - routing_key: None, - no_wait: false, - })?; - - let handle = easylapin::WorkerChannel(chan).consume( - tasks::githubcommentposter::GitHubCommentPoster::new(cfg.github_app_vendingmachine()), - easyamqp::ConsumeConfig { - queue: "build-results".to_owned(), - consumer_tag: format!("{}-github-comment-poster", cfg.whoami()), - no_local: false, - no_ack: false, - no_wait: false, - exclusive: false, - }, - )?; - - task::block_on(handle); - - drop(conn); // Close connection. - info!("Closed the session... EOF"); - Ok(()) -}