Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
926199a487
commit
5378b5f537
@ -7,3 +7,61 @@ pub mod dagger_middleware;
|
||||
pub mod node_service;
|
||||
pub mod rust_lib;
|
||||
pub mod rust_service;
|
||||
|
||||
pub mod cuddle_releaser {
|
||||
use async_trait::async_trait;
|
||||
|
||||
use crate::{rust_service::RustService, MainAction};
|
||||
|
||||
pub struct CuddleReleaser {
|
||||
client: dagger_sdk::Query,
|
||||
options: CuddleReleaserOptions,
|
||||
}
|
||||
|
||||
pub struct CuddleReleaserOptions {
|
||||
upstream: String,
|
||||
folder: String,
|
||||
cluster: String,
|
||||
namespace: String,
|
||||
app: String,
|
||||
}
|
||||
|
||||
impl CuddleReleaser {
|
||||
pub async fn new(
|
||||
client: dagger_sdk::Query,
|
||||
options: CuddleReleaserOptions,
|
||||
) -> eyre::Result<Self> {
|
||||
Ok(Self { client, options })
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl MainAction for CuddleReleaser {
|
||||
async fn execute_main(&self) -> eyre::Result<()> {
|
||||
let client = self.client;
|
||||
|
||||
let cuddle_releaser_image = "docker.io/kasperhermansen:cuddle-releaser:main-1706438736";
|
||||
|
||||
let folder = client.host().directory(self.options.folder);
|
||||
|
||||
let cuddle_releaser = client
|
||||
.container()
|
||||
.from(cuddle_releaser_image)
|
||||
.with_mounted_directory("/mnt/templates", folder);
|
||||
|
||||
cuddle_releaser
|
||||
.with_exec(vec![
|
||||
"cuddle-releaser",
|
||||
"release",
|
||||
&format!("--upstream={}", self.options.upstream),
|
||||
&format!("--folder={}", "/mnt/templates"),
|
||||
&format!("--cluster={}", self.options.cluster),
|
||||
&format!("--namespace={}", self.options.namespace),
|
||||
&format!("--app={}", self.options.app),
|
||||
])
|
||||
.sync()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user