Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
7363871ffb
commit
2b4a67e38c
@ -417,6 +417,7 @@ mod assets;
|
|||||||
mod cargo_binstall;
|
mod cargo_binstall;
|
||||||
mod cargo_clean;
|
mod cargo_clean;
|
||||||
mod clap_sanity_test;
|
mod clap_sanity_test;
|
||||||
|
mod cuddle_cli;
|
||||||
mod docker_cache;
|
mod docker_cache;
|
||||||
mod docker_cli;
|
mod docker_cli;
|
||||||
mod mold;
|
mod mold;
|
||||||
@ -430,6 +431,7 @@ pub mod extensions {
|
|||||||
pub use super::cargo_binstall::*;
|
pub use super::cargo_binstall::*;
|
||||||
pub use super::cargo_clean::*;
|
pub use super::cargo_clean::*;
|
||||||
pub use super::clap_sanity_test::*;
|
pub use super::clap_sanity_test::*;
|
||||||
|
pub use super::cuddle_cli::*;
|
||||||
pub use super::docker_cache::*;
|
pub use super::docker_cache::*;
|
||||||
pub use super::docker_cli::*;
|
pub use super::docker_cli::*;
|
||||||
pub use super::mold::*;
|
pub use super::mold::*;
|
||||||
|
49
crates/cuddle-ci/src/rust_service/cuddle_cli.rs
Normal file
49
crates/cuddle-ci/src/rust_service/cuddle_cli.rs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use async_trait::async_trait;
|
||||||
|
use dagger_sdk::Container;
|
||||||
|
|
||||||
|
use crate::dagger_middleware::DaggerMiddleware;
|
||||||
|
|
||||||
|
use super::RustService;
|
||||||
|
|
||||||
|
pub struct CuddleCli {
|
||||||
|
client: dagger_sdk::Query,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CuddleCli {
|
||||||
|
pub fn new(client: dagger_sdk::Query) -> Self {
|
||||||
|
Self { client }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
|
impl DaggerMiddleware for CuddleCli {
|
||||||
|
async fn handle(&self, container: Container) -> eyre::Result<Container> {
|
||||||
|
let cuddle = self
|
||||||
|
.client
|
||||||
|
.container()
|
||||||
|
.from("kasperhermansen/cuddle:latest");
|
||||||
|
|
||||||
|
Ok(container.with_file(
|
||||||
|
"/usr/local/bin/cuddle",
|
||||||
|
cuddle.file("/usr/local/cargo/cuddle"),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait CuddleCliExt {
|
||||||
|
fn with_cuddle_cli(&mut self) -> &mut Self {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CuddleCliExt for RustService {
|
||||||
|
fn with_cuddle_cli(&mut self) -> &mut Self {
|
||||||
|
self.with_stage(super::RustServiceStage::BeforePackage(Arc::new(
|
||||||
|
CuddleCli::new(self.client.clone()),
|
||||||
|
)));
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user