feat: produce new templates

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

2
Cargo.lock generated
View File

@ -335,7 +335,7 @@ dependencies = [
[[package]] [[package]]
name = "cuddle-clusters" name = "cuddle-clusters"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.front.kjuulh.io/kjuulh/cuddle-clusters?tag=v0.1.1#10a56ad69062776f24f853996b9eeb2da49dec4a" source = "git+https://git.front.kjuulh.io/kjuulh/cuddle-clusters?branch=main#545439923f384585c791bfb767b183192e0b1a0e"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",

View File

@ -11,4 +11,4 @@ tracing-subscriber = { version = "0.3.18" }
clap = { version = "4.5.4", features = ["derive", "env"] } clap = { version = "4.5.4", features = ["derive", "env"] }
dotenv = { version = "0.15.0" } dotenv = { version = "0.15.0" }
cuddle-clusters = { git = "https://git.front.kjuulh.io/kjuulh/cuddle-clusters", tag = "v0.1.1" } cuddle-clusters = { git = "https://git.front.kjuulh.io/kjuulh/cuddle-clusters", branch = "main" } #tag = "v0.1.1" }

View File

@ -1,5 +1,3 @@
use std::sync::Arc;
use async_trait::async_trait; use async_trait::async_trait;
use cuddle_ci::cuddle_file::CuddleFile; use cuddle_ci::cuddle_file::CuddleFile;
use cuddle_ci::cuddle_releaser::CuddleReleaser; 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::RustService;
use cuddle_ci::rust_service::{extensions::*, RustServiceContext}; use cuddle_ci::rust_service::{extensions::*, RustServiceContext};
use cuddle_ci::{Context, CuddleCI, MainAction, PullRequestAction}; use cuddle_ci::{Context, CuddleCI, MainAction, PullRequestAction};
use tokio::sync::Mutex;
#[tokio::main] #[tokio::main]
async fn main() -> eyre::Result<()> { async fn main() -> eyre::Result<()> {
@ -47,20 +44,20 @@ async fn main() -> eyre::Result<()> {
#[derive(Default, Clone)] #[derive(Default, Clone)]
struct RustServiceRender {} 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] #[async_trait]
impl MainAction for RustServiceRender { impl MainAction for RustServiceRender {
async fn execute_main(&self, ctx: &mut Context) -> eyre::Result<()> { async fn execute_main(&self, ctx: &mut Context) -> eyre::Result<()> {
let image_tag = ctx self.render_templates().await?;
.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?;
Ok(()) Ok(())
} }
@ -69,17 +66,7 @@ impl MainAction for RustServiceRender {
#[async_trait] #[async_trait]
impl PullRequestAction for RustServiceRender { impl PullRequestAction for RustServiceRender {
async fn execute_pull_request(&self, ctx: &mut Context) -> eyre::Result<()> { async fn execute_pull_request(&self, ctx: &mut Context) -> eyre::Result<()> {
let image_tag = ctx self.render_templates().await?;
.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?;
Ok(()) Ok(())
} }