From 1d2cba49aaf42d14ff25c64f5ed0ebfb186bd645 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Fri, 11 Aug 2023 20:01:05 +0200 Subject: [PATCH] feat: fix ssh issues Signed-off-by: kjuulh --- crates/dagger-cuddle-please/src/lib.rs | 25 +++++++++++++++++++ .../src/main.rs | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/crates/dagger-cuddle-please/src/lib.rs b/crates/dagger-cuddle-please/src/lib.rs index 3b4d4b9..f6671f6 100644 --- a/crates/dagger-cuddle-please/src/lib.rs +++ b/crates/dagger-cuddle-please/src/lib.rs @@ -295,6 +295,31 @@ impl DaggerCuddlePlease { ) .with_workdir("/mnt/app") .with_directory(".", client.host().directory(".").id().await?) + .with_unix_socket( + "/tmp/ssh.sock", + client + .host() + .unix_socket( + std::env::var("SSH_AUTH_SOCK").expect("expect SSH_AUTH_SOCK to be present"), + ) + .id() + .await?, + ) + .with_env_variable("SSH_AUTH_SOCK", "/tmp/ssh.sock") + .with_new_file_opts( + "/root/.ssh/config", + dagger_sdk::ContainerWithNewFileOpts { + contents: Some( + " +Host * + StrictHostKeyChecking no + UserKnownHostsFile /dev/null + ", + ), + owner: Some("root"), + permissions: Some(700), + }, + ) .with_exec(vec![ "cuddle-please", "release", diff --git a/examples/gitea-cuddle-file-cuddle-please/src/main.rs b/examples/gitea-cuddle-file-cuddle-please/src/main.rs index 17d112b..a840eda 100644 --- a/examples/gitea-cuddle-file-cuddle-please/src/main.rs +++ b/examples/gitea-cuddle-file-cuddle-please/src/main.rs @@ -11,7 +11,7 @@ pub async fn main() -> eyre::Result<()> { token: std::env::var("CUDDLE_PLEASE_TOKEN") .expect("CUDDLE_PLEASE_TOKEN to be present"), }, - log_level: None, + log_level: Some(dagger_cuddle_please::models::LogLevel::Debug), use_ssh_socket: true, }) .await?;