feat: produce new templates

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-05-25 14:08:54 +02:00
parent f112bcf1a9
commit 03d293bdc8
3 changed files with 14 additions and 27 deletions

View File

@@ -1,5 +1,3 @@
use std::sync::Arc;
use async_trait::async_trait;
use cuddle_ci::cuddle_file::CuddleFile;
use cuddle_ci::cuddle_releaser::CuddleReleaser;
@@ -7,7 +5,6 @@ use cuddle_ci::rust_service::architecture::{Architecture, Os};
use cuddle_ci::rust_service::RustService;
use cuddle_ci::rust_service::{extensions::*, RustServiceContext};
use cuddle_ci::{Context, CuddleCI, MainAction, PullRequestAction};
use tokio::sync::Mutex;
#[tokio::main]
async fn main() -> eyre::Result<()> {
@@ -47,20 +44,20 @@ async fn main() -> eyre::Result<()> {
#[derive(Default, Clone)]
struct RustServiceRender {}
impl RustServiceRender {
async fn render_templates(&self) -> eyre::Result<()> {
cuddle_clusters::process()
.await
.map_err(|e| eyre::anyhow!("failed to process templates: {}", e.to_string()))?;
Ok(())
}
}
#[async_trait]
impl MainAction for RustServiceRender {
async fn execute_main(&self, ctx: &mut Context) -> eyre::Result<()> {
let image_tag = ctx
.get_image_tag()?
.ok_or(eyre::anyhow!("failed to find image_tag"))?;
cuddle_ci::cuddle_x::well_known::render(vec![
"--cluster",
"clank-prod",
"--image_tag",
&image_tag,
])
.await?;
self.render_templates().await?;
Ok(())
}
@@ -69,17 +66,7 @@ impl MainAction for RustServiceRender {
#[async_trait]
impl PullRequestAction for RustServiceRender {
async fn execute_pull_request(&self, ctx: &mut Context) -> eyre::Result<()> {
let image_tag = ctx
.get_image_tag()?
.ok_or(eyre::anyhow!("failed to find image_tag"))?;
cuddle_ci::cuddle_x::well_known::render(vec![
"--cluster",
"clank-dev",
"--image_tag",
&image_tag,
])
.await?;
self.render_templates().await?;
Ok(())
}