summaryrefslogtreecommitdiff
path: root/ofborg/tickborg/src/bin
diff options
context:
space:
mode:
authorMehmet Samet Duman <yongdohyun@projecttick.org>2026-04-04 23:00:30 +0300
committerMehmet Samet Duman <yongdohyun@projecttick.org>2026-04-04 23:00:30 +0300
commit71ffb442e5f8072c6e0a974df9ae085bcf0e5d2a (patch)
treed336b1d64747aeebb1a80c2e7c4e9b5d24253751 /ofborg/tickborg/src/bin
parentf96ea38d595162813a460f80f84e20f8d7f241bc (diff)
downloadProject-Tick-71ffb442e5f8072c6e0a974df9ae085bcf0e5d2a.tar.gz
Project-Tick-71ffb442e5f8072c6e0a974df9ae085bcf0e5d2a.zip
NOISSUE update bootstrap script paths in documentation for Linux and Windows
remove unnecessary badges from README add example environment configuration for Ofborg create production configuration for Ofborg correct RabbitMQ host in example configuration add push event handling in GitHub webhook receiver implement push filter task for handling push events extend build job structure to include push event information enhance build result structure to accommodate push event data add push event data handling in various message processing tasks update log message collector to prevent 404 errors on log links add push filter task to task module Signed-off-by: Mehmet Samet Duman <yongdohyun@projecttick.org>
Diffstat (limited to 'ofborg/tickborg/src/bin')
-rw-r--r--ofborg/tickborg/src/bin/build-faker.rs1
-rw-r--r--ofborg/tickborg/src/bin/github-webhook-receiver.rs18
-rw-r--r--ofborg/tickborg/src/bin/push-filter.rs105
3 files changed, 124 insertions, 0 deletions
diff --git a/ofborg/tickborg/src/bin/build-faker.rs b/ofborg/tickborg/src/bin/build-faker.rs
index df8fcbfa50..086e96493d 100644
--- a/ofborg/tickborg/src/bin/build-faker.rs
+++ b/ofborg/tickborg/src/bin/build-faker.rs
@@ -42,6 +42,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
logs: Some((Some("logs".to_owned()), Some(logbackrk.to_lowercase()))),
statusreport: Some((None, Some("scratch".to_owned()))),
request_id: "bogus-request-id".to_owned(),
+ push: None,
};
{
diff --git a/ofborg/tickborg/src/bin/github-webhook-receiver.rs b/ofborg/tickborg/src/bin/github-webhook-receiver.rs
index 910cd4b350..60698a5019 100644
--- a/ofborg/tickborg/src/bin/github-webhook-receiver.rs
+++ b/ofborg/tickborg/src/bin/github-webhook-receiver.rs
@@ -87,6 +87,24 @@ async fn setup_amqp(chan: &mut Channel) -> Result<(), Box<dyn Error + Send + Syn
no_wait: false,
})
.await?;
+
+ let queue_name = String::from("push-build-inputs");
+ chan.declare_queue(easyamqp::QueueConfig {
+ queue: queue_name.clone(),
+ passive: false,
+ durable: true,
+ exclusive: false,
+ auto_delete: false,
+ no_wait: false,
+ })
+ .await?;
+ chan.bind_queue(easyamqp::BindQueueConfig {
+ queue: queue_name.clone(),
+ exchange: "github-events".to_owned(),
+ routing_key: Some(String::from("push.*")),
+ no_wait: false,
+ })
+ .await?;
Ok(())
}
diff --git a/ofborg/tickborg/src/bin/push-filter.rs b/ofborg/tickborg/src/bin/push-filter.rs
new file mode 100644
index 0000000000..81d1597e0f
--- /dev/null
+++ b/ofborg/tickborg/src/bin/push-filter.rs
@@ -0,0 +1,105 @@
+use std::env;
+use std::error::Error;
+
+use tracing::{error, info};
+
+use tickborg::config;
+use tickborg::easyamqp::{self, ChannelExt, ConsumerExt};
+use tickborg::easylapin;
+use tickborg::tasks;
+
+#[tokio::main]
+async fn main() -> Result<(), Box<dyn Error>> {
+ tickborg::setup_log();
+
+ let arg = env::args()
+ .nth(1)
+ .unwrap_or_else(|| panic!("usage: {} <config>", std::env::args().next().unwrap()));
+ let cfg = config::load(arg.as_ref());
+
+ let Some(filter_cfg) = config::load(arg.as_ref()).push_filter else {
+ error!("No push filter configuration found!");
+ panic!();
+ };
+
+ let conn = easylapin::from_config(&filter_cfg.rabbitmq).await?;
+ let mut chan = conn.create_channel().await?;
+
+ 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,
+ })
+ .await?;
+
+ // Declare the build-jobs exchange (fanout) that the builder consumes from
+ 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,
+ })
+ .await?;
+
+ // Declare the build-results exchange for the comment poster
+ 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,
+ })
+ .await?;
+
+ let queue_name = String::from("push-build-inputs");
+ chan.declare_queue(easyamqp::QueueConfig {
+ queue: queue_name.clone(),
+ passive: false,
+ durable: true,
+ exclusive: false,
+ auto_delete: false,
+ no_wait: false,
+ })
+ .await?;
+
+ chan.bind_queue(easyamqp::BindQueueConfig {
+ queue: queue_name.clone(),
+ exchange: "github-events".to_owned(),
+ routing_key: Some("push.*".to_owned()),
+ no_wait: false,
+ })
+ .await?;
+
+ let handle = easylapin::WorkerChannel(chan)
+ .consume(
+ tasks::pushfilter::PushFilterWorker::new(
+ cfg.acl(),
+ filter_cfg.default_attrs,
+ ),
+ easyamqp::ConsumeConfig {
+ queue: queue_name.clone(),
+ consumer_tag: format!("{}-push-filter", cfg.whoami()),
+ no_local: false,
+ no_ack: false,
+ no_wait: false,
+ exclusive: false,
+ },
+ )
+ .await?;
+
+ info!("Fetching push events from {}", &queue_name);
+ handle.await;
+
+ drop(conn); // Close connection.
+ info!("Closed the session... EOF");
+ Ok(())
+}