From 9d47c90df33e183294d0884c89e3df035c6e7b22 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sat, 17 Feb 2024 13:56:35 +0100 Subject: [PATCH] feat: add pr Signed-off-by: kjuulh --- crates/cuddle-rust-service-plan/src/main.rs | 24 ++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/crates/cuddle-rust-service-plan/src/main.rs b/crates/cuddle-rust-service-plan/src/main.rs index 301e86b..abc78e4 100644 --- a/crates/cuddle-rust-service-plan/src/main.rs +++ b/crates/cuddle-rust-service-plan/src/main.rs @@ -6,7 +6,7 @@ use cuddle_ci::cuddle_releaser::CuddleReleaser; 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}; +use cuddle_ci::{Context, CuddleCI, MainAction, PullRequestAction}; use tokio::sync::Mutex; #[tokio::main] @@ -32,6 +32,9 @@ async fn main() -> eyre::Result<()> { let deployment = Arc::new(Mutex::new(CuddleReleaser::new(client).await?)); CuddleCI::default() + .with_pull_request(service.clone()) + //.with_pull_request(render.clone()) + //.with_pull_request(deployment.clone()) .with_main(service.clone()) .with_main(render.clone()) .with_main(deployment.clone()) @@ -62,3 +65,22 @@ impl MainAction for RustServiceRender { Ok(()) } } + +#[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?; + + Ok(()) + } +}