feat: add pr
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2024-02-17 13:56:35 +01:00
parent aade9764ed
commit 9d47c90df3
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394

View File

@ -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(())
}
}