Add a pipeline to build the server image.

This commit is contained in:
Tom Alexander
2024-09-29 00:19:22 -04:00
parent a2aca6d2f1
commit 0548571b6b
7 changed files with 263 additions and 31 deletions

View File

@@ -9,7 +9,7 @@ use serde_json::Value;
#[serde(deny_unknown_fields)]
pub(crate) struct HookPush {
#[serde(rename = "ref")]
ref_field: String,
pub(crate) ref_field: String,
before: String,
after: String,
compare_url: String,

View File

@@ -39,7 +39,7 @@ mod kubernetes;
mod remote_config;
mod webhook;
const EXAMPLE_WEBHOOK_PAYLOAD: &'static str = include_str!("../example_webhook_payload.json");
const EXAMPLE_WEBHOOK_PAYLOAD: &'static str = include_str!("../example_tag_webhook_payload.json");
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
@@ -69,9 +69,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
)
.await?;
let remote_config = discover_webhook_bridge_config(&gitea, &repo_tree).await?;
let pipelines =
discover_matching_push_triggers(&gitea, &repo_tree, "refs/heads/main", &remote_config)
.await?;
let pipelines = discover_matching_push_triggers(
&gitea,
&repo_tree,
&webhook_payload.ref_field,
&remote_config,
)
.await?;
run_pipelines(webhook_payload, pipelines, kubernetes_client).await?;

View File

@@ -62,7 +62,7 @@ impl RemoteConfig {
.iter()
.map(|s| Regex::new(s.as_str()))
.collect::<Result<_, _>>()?;
if !push.branches.is_empty() && match_regex.iter().any(|r| r.is_match(branch)) {
if !push.branches.is_empty() && !match_regex.iter().any(|r| r.is_match(branch)) {
continue;
}