feat: use new dagger connect closure
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-12-26 22:55:14 +01:00
parent 027e375baa
commit ab61a5b89f
3 changed files with 55 additions and 76 deletions

39
Cargo.lock generated
View File

@ -194,7 +194,7 @@ dependencies = [
"cuddle-ci", "cuddle-ci",
"dagger-components", "dagger-components",
"dagger-rust", "dagger-rust",
"dagger-sdk 0.9.8", "dagger-sdk",
"eyre", "eyre",
"tokio", "tokio",
] ]
@ -309,7 +309,7 @@ dependencies = [
"clap", "clap",
"dagger-cuddle-please", "dagger-cuddle-please",
"dagger-rust", "dagger-rust",
"dagger-sdk 0.13.7", "dagger-sdk",
"eyre", "eyre",
"futures", "futures",
"serde", "serde",
@ -328,7 +328,7 @@ dependencies = [
"cuddle-ci", "cuddle-ci",
"dagger-components", "dagger-components",
"dagger-rust", "dagger-rust",
"dagger-sdk 0.9.8", "dagger-sdk",
"eyre", "eyre",
"tokio", "tokio",
] ]
@ -344,7 +344,7 @@ version = "0.3.0"
source = "git+https://git.front.kjuulh.io/kjuulh/dagger-components?branch=main#2d48b523c31a48feef330673baf05a6d93e7e6ad" source = "git+https://git.front.kjuulh.io/kjuulh/dagger-components?branch=main#2d48b523c31a48feef330673baf05a6d93e7e6ad"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"dagger-sdk 0.13.7", "dagger-sdk",
"eyre", "eyre",
] ]
@ -354,40 +354,11 @@ version = "0.3.0"
source = "git+https://git.front.kjuulh.io/kjuulh/dagger-components?branch=main#2d48b523c31a48feef330673baf05a6d93e7e6ad" source = "git+https://git.front.kjuulh.io/kjuulh/dagger-components?branch=main#2d48b523c31a48feef330673baf05a6d93e7e6ad"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"dagger-sdk 0.13.7", "dagger-sdk",
"eyre", "eyre",
"tokio", "tokio",
] ]
[[package]]
name = "dagger-sdk"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79bc59868e62ea1451f158aeb8fbb36c5dd2fb098f31bf408dbd165251674edf"
dependencies = [
"async-trait",
"base64",
"derive_builder",
"dirs",
"eyre",
"flate2",
"futures",
"graphql_client",
"hex",
"hex-literal",
"platform-info",
"reqwest",
"serde",
"serde_json",
"sha2",
"tar",
"tempfile",
"thiserror",
"tokio",
"tracing",
"tracing-subscriber",
]
[[package]] [[package]]
name = "dagger-sdk" name = "dagger-sdk"
version = "0.13.7" version = "0.13.7"

View File

@ -7,40 +7,44 @@ const BIN_NAME: &str = "cuddle-node-service-plan";
#[tokio::main] #[tokio::main]
async fn main() -> eyre::Result<()> { async fn main() -> eyre::Result<()> {
let client = dagger_sdk::connect().await?; dagger_sdk::connect(|client| async move {
let service = &RustService::from(client.clone())
.with_arch(Architecture::Amd64)
.with_os(Os::Linux)
.with_apt(&[
"clang",
"libssl-dev",
"libz-dev",
"libgit2-dev",
"git",
"openssh-client",
])
.with_apt_release(&["git", "openssh-client"])
.with_docker_cli()
.with_cuddle_cli()
.with_kubectl()
.with_apt_ca_certificates()
.with_crates(["ci", "crates/*"])
.with_mold("2.3.3")
.with_bin_name(BIN_NAME)
.with_deployment(false)
.to_owned();
let service = &RustService::from(client.clone()) let drone_templater =
.with_arch(Architecture::Amd64) &DroneTemplater::new(client, "templates/cuddle-node-service-plan.yaml")
.with_os(Os::Linux) .with_variable("bin_name", BIN_NAME)
.with_apt(&[ .to_owned();
"clang",
"libssl-dev",
"libz-dev",
"libgit2-dev",
"git",
"openssh-client",
])
.with_apt_release(&["git", "openssh-client"])
.with_docker_cli()
.with_cuddle_cli()
.with_kubectl()
.with_apt_ca_certificates()
.with_crates(["ci", "crates/*"])
.with_mold("2.3.3")
.with_bin_name(BIN_NAME)
.with_deployment(false)
.to_owned();
let drone_templater = &DroneTemplater::new(client, "templates/cuddle-node-service-plan.yaml") CuddleCI::default()
.with_variable("bin_name", BIN_NAME) .with_pull_request(service)
.to_owned(); .with_main(service)
.with_main(drone_templater)
.execute(std::env::args())
.await?;
CuddleCI::default() Ok(())
.with_pull_request(service) })
.with_main(service) .await?;
.with_main(drone_templater)
.execute(std::env::args())
.await?;
Ok(()) Ok(())
} }

View File

@ -5,19 +5,23 @@ use cuddle_ci::CuddleCI;
#[tokio::main] #[tokio::main]
async fn main() -> eyre::Result<()> { async fn main() -> eyre::Result<()> {
let client = dagger_sdk::connect().await?; dagger_sdk::connect(|client| async move {
let cuddle_file = CuddleFile::from_cuddle_file().await?; let cuddle_file = CuddleFile::from_cuddle_file().await?;
let service = &NodeService::new(client.clone(), &cuddle_file.vars.service) let service = &NodeService::new(client.clone(), &cuddle_file.vars.service)
.with_arch(Architecture::Amd64) .with_arch(Architecture::Amd64)
.with_os(Os::Linux) .with_os(Os::Linux)
.to_owned(); .to_owned();
CuddleCI::default() CuddleCI::default()
.with_pull_request(service) .with_pull_request(service)
.with_main(service) .with_main(service)
.execute(std::env::args()) .execute(std::env::args())
.await?; .await?;
Ok(())
})
.await?;
Ok(()) Ok(())
} }