Add parsing of the in-repo config file format.

This commit is contained in:
Tom Alexander
2024-09-28 14:29:18 -04:00
parent 201709c360
commit c32a8650f5
5 changed files with 119 additions and 15 deletions

View File

@@ -20,6 +20,7 @@ use tracing_subscriber::util::SubscriberInitExt;
use self::crd_pipeline_run::PipelineRun;
use self::gitea_client::GiteaClient;
use self::in_repo_config::InRepoConfig;
use self::webhook::hook;
use self::webhook::verify_signature;
use kube::CustomResourceExt;
@@ -27,9 +28,11 @@ use kube::CustomResourceExt;
mod crd_pipeline_run;
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>> {
@@ -50,13 +53,15 @@ 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?;
// gitea
// .get_tree(
// "talexander",
// "organic",
// "841a348dd02f31ee8828f069b2a948712369069d",
// )
// .await?;
let parsed_in_repo_config: InRepoConfig = toml::from_str(TEST_IN_REPO_CONFIG)?;
// let jobs: Api<PipelineRun> = Api::namespaced(kubernetes_client, "lighthouse");
// let jobs: Api<PipelineRun> = Api::default_namespaced(kubernetes_client);