Generate names for pipeline runs.
Some checks failed
format Build format has succeeded
clippy Build clippy has failed
rust-test Build rust-test has succeeded

This commit is contained in:
Tom Alexander
2024-09-28 21:50:50 -04:00
parent 470031251c
commit efe37f020a
4 changed files with 108 additions and 26 deletions

View File

@@ -1,4 +1,5 @@
#![forbid(unsafe_code)]
use std::borrow::Borrow;
use std::sync::Arc;
use std::time::Duration;
@@ -23,6 +24,7 @@ use self::discovery::discover_matching_push_triggers;
use self::discovery::discover_webhook_bridge_config;
use self::gitea_client::GiteaClient;
use self::hook_push::HookPush;
use self::hook_push::PipelineParamters;
use self::in_repo_config::InRepoConfig;
use self::kubernetes::run_pipelines;
use self::webhook::hook;
@@ -58,11 +60,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let gitea_api_token = std::env::var("WEBHOOK_BRIDGE_OAUTH_TOKEN")?;
let gitea = GiteaClient::new(gitea_api_root, gitea_api_token);
let webhook_payload: HookPush = serde_json::from_str(EXAMPLE_WEBHOOK_PAYLOAD)?;
let repo_tree = gitea
.get_tree(
"talexander",
"webhook_bridge",
"b8444344c4821e87a894cd195f8bec39cd501f68",
webhook_payload.get_pull_base_sha()?,
)
.await?;
let in_repo_config = discover_webhook_bridge_config(&gitea, &repo_tree).await?;
@@ -70,8 +73,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
discover_matching_push_triggers(&gitea, &repo_tree, "refs/heads/main", &in_repo_config)
.await?;
let webhook_payload: HookPush = serde_json::from_str(EXAMPLE_WEBHOOK_PAYLOAD)?;
run_pipelines(webhook_payload, pipelines, kubernetes_client).await?;
// let app = Router::new()