Fetch the in-repo config file from the remote repo.

This commit is contained in:
Tom Alexander
2024-09-28 16:51:27 -04:00
parent c32a8650f5
commit 66228f83f2
6 changed files with 97 additions and 16 deletions

View File

@@ -19,6 +19,7 @@ use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;
use self::crd_pipeline_run::PipelineRun;
use self::discovery::discover_webhook_bridge_config;
use self::gitea_client::GiteaClient;
use self::in_repo_config::InRepoConfig;
use self::webhook::hook;
@@ -26,13 +27,13 @@ use self::webhook::verify_signature;
use kube::CustomResourceExt;
mod crd_pipeline_run;
mod discovery;
mod gitea_client;
mod hook_push;
mod in_repo_config;
mod webhook;
const EXAMPLE_PIPELINE_RUN: &'static str = include_str!("../example_pipeline_run.json");
const TEST_IN_REPO_CONFIG: &'static str = include_str!("../.webhook_bridge/webhook_bridge.toml");
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
@@ -53,15 +54,13 @@ 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);
// gitea
// .get_tree(
// "talexander",
// "organic",
// "841a348dd02f31ee8828f069b2a948712369069d",
// )
// .await?;
let parsed_in_repo_config: InRepoConfig = toml::from_str(TEST_IN_REPO_CONFIG)?;
discover_webhook_bridge_config(
&gitea,
"talexander",
"webhook_bridge",
"c32a8650f509b5e4bbf6df0c210a3a01ad405eb5",
)
.await?;
// let jobs: Api<PipelineRun> = Api::namespaced(kubernetes_client, "lighthouse");
// let jobs: Api<PipelineRun> = Api::default_namespaced(kubernetes_client);