feat: can use ssh sock
Some checks failed
continuous-integration/drone/push Build is failing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2023-11-27 22:18:05 +01:00
parent e5b3e1b62a
commit 663feba85d
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912

View File

@ -341,28 +341,36 @@ impl MainAction for RustService {
let update_deployments_docker_image = let update_deployments_docker_image =
"docker.io/kasperhermansen/update-deployment:1690401410"; "docker.io/kasperhermansen/update-deployment:1690401410";
self.client let dep = self
.client
.container() .container()
.from(update_deployments_docker_image) .from(update_deployments_docker_image);
.with_env_variable("GIT_USERNAME", "kjuulh")
.with_env_variable( let dep = if let Some(sock) = std::env::var("SSH_AUTH_SOCK").ok() {
"GIT_PASSWORD", dep.with_unix_socket("/tmp/ssh_sock", self.client.host().unix_socket(sock))
std::env::var("GIT_PASSWORD").expect("GIT_PASSWORD to be set"), .with_env_variable("SSH_AUTH_SOCK", "/tmp/ssh_sock")
) } else {
.with_exec(vec![ dep.with_env_variable("GIT_USERNAME", "kjuulh")
"update-deployment", .with_env_variable(
"--repo", "GIT_PASSWORD",
&format!( std::env::var("GIT_PASSWORD").expect("GIT_PASSWORD to be set"),
"https://git.front.kjuulh.io/kjuulh/{}-deployment.git", )
self.bin_name };
),
"--service", dep.with_exec(vec![
&self.bin_name, "update-deployment",
"--image", "--repo",
&format!("kasperhermansen/{}:main-{}", self.bin_name, timestamp), &format!(
]) "https://git.front.kjuulh.io/kjuulh/{}-deployment.git",
.sync() self.bin_name
.await?; ),
"--service",
&self.bin_name,
"--image",
&format!("kasperhermansen/{}:main-{}", self.bin_name, timestamp),
])
.sync()
.await?;
Ok(()) Ok(())
} }