2023-11-25 23:09:49 +01:00
|
|
|
pub mod cli;
|
|
|
|
pub use cli::*;
|
2023-11-25 21:41:17 +01:00
|
|
|
|
2024-01-28 20:44:12 +01:00
|
|
|
pub mod leptos_service;
|
2023-12-26 17:20:31 +01:00
|
|
|
pub mod node_service;
|
2023-12-29 17:18:02 +01:00
|
|
|
pub mod rust_lib;
|
2023-11-25 23:14:38 +01:00
|
|
|
pub mod rust_service;
|
2024-01-28 19:20:38 +01:00
|
|
|
|
2024-01-28 20:44:12 +01:00
|
|
|
pub mod cuddle_file;
|
|
|
|
pub mod cuddle_please;
|
|
|
|
pub mod cuddle_releaser;
|
2024-01-28 21:06:16 +01:00
|
|
|
pub mod cuddle_x;
|
2024-01-28 20:44:12 +01:00
|
|
|
pub mod dagger_middleware;
|
2024-03-30 01:41:33 +01:00
|
|
|
pub mod drone_templater {
|
|
|
|
use std::path::PathBuf;
|
|
|
|
|
|
|
|
const DRONE_TEMPLATER_IMAGE: &str = "kasperhermansen/drone-templater:main-1711758171";
|
|
|
|
|
|
|
|
use async_trait::async_trait;
|
|
|
|
|
|
|
|
use crate::MainAction;
|
|
|
|
|
|
|
|
pub struct DroneTemplater {
|
|
|
|
client: dagger_sdk::Query,
|
|
|
|
template: PathBuf,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl DroneTemplater {
|
|
|
|
pub fn new(client: dagger_sdk::Query, template: impl Into<PathBuf>) -> Self {
|
|
|
|
Self {
|
|
|
|
client: client.pipeline("drone-templater"),
|
|
|
|
template: template.into(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[async_trait]
|
|
|
|
impl MainAction for DroneTemplater {
|
|
|
|
async fn execute_main(&self, _ctx: &mut crate::Context) -> eyre::Result<()> {
|
2024-03-30 01:46:25 +01:00
|
|
|
let src = self.client.host().directory(".cuddle/tmp/");
|
2024-03-30 01:41:33 +01:00
|
|
|
|
|
|
|
let drone_host = std::env::var("DRONE_HOST");
|
|
|
|
let drone_user = std::env::var("DRONE_USER");
|
|
|
|
let drone_token = std::env::var("DRONE_TOKEN");
|
|
|
|
|
|
|
|
let drone_token_secret = client.set_secret("DRONE_TOKEN", drone_token);
|
|
|
|
|
2024-03-30 01:46:25 +01:00
|
|
|
self.client
|
2024-03-30 01:41:33 +01:00
|
|
|
.container()
|
|
|
|
.from(DRONE_TEMPLATER_IMAGE)
|
|
|
|
.with_directory("/src/templates", src)
|
|
|
|
.with_workdir("/src")
|
|
|
|
.with_env_variable("DRONE_HOST", drone_host)
|
|
|
|
.with_env_variable("DRONE_USER", drone_user)
|
|
|
|
.with_secret_variable("DRONE_TOKEN", drone_token_secret)
|
|
|
|
.with_exec(vec![
|
|
|
|
"drone-templater",
|
|
|
|
"upload",
|
|
|
|
"--template",
|
2024-03-30 01:46:25 +01:00
|
|
|
&self.template.display(),
|
2024-03-30 01:41:33 +01:00
|
|
|
]);
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|