feat: update with ssh
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:32:27 +01:00
parent 9c3f806a80
commit 12b7c27342
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912

View File

@ -340,7 +340,7 @@ impl MainAction for RustService {
.await?; .await?;
let update_deployments_docker_image = let update_deployments_docker_image =
"docker.io/kasperhermansen/update-deployment:1701119710"; "docker.io/kasperhermansen/update-deployment:1701120709";
let dep = self let dep = self
.client .client
.container() .container()
@ -349,15 +349,25 @@ impl MainAction for RustService {
let dep = if let Some(sock) = std::env::var("SSH_AUTH_SOCK").ok() { let dep = if let Some(sock) = std::env::var("SSH_AUTH_SOCK").ok() {
dep.with_unix_socket("/tmp/ssh_sock", self.client.host().unix_socket(sock)) dep.with_unix_socket("/tmp/ssh_sock", self.client.host().unix_socket(sock))
.with_env_variable("SSH_AUTH_SOCK", "/tmp/ssh_sock") .with_env_variable("SSH_AUTH_SOCK", "/tmp/ssh_sock")
.with_exec(vec![
"update-deployment",
"--repo",
&format!(
"ssh://git@git.front.kjuulh.io/kjuulh/{}-deployment.git",
self.bin_name
),
"--service",
&self.bin_name,
"--image",
&format!("kasperhermansen/{}:main-{}", self.bin_name, timestamp),
])
} else { } else {
dep.with_env_variable("GIT_USERNAME", "kjuulh") dep.with_env_variable("GIT_USERNAME", "kjuulh")
.with_env_variable( .with_env_variable(
"GIT_PASSWORD", "GIT_PASSWORD",
std::env::var("GIT_PASSWORD").expect("GIT_PASSWORD to be set"), std::env::var("GIT_PASSWORD").expect("GIT_PASSWORD to be set"),
) )
}; .with_exec(vec![
dep.with_exec(vec![
"update-deployment", "update-deployment",
"--repo", "--repo",
&format!( &format!(
@ -369,8 +379,9 @@ impl MainAction for RustService {
"--image", "--image",
&format!("kasperhermansen/{}:main-{}", self.bin_name, timestamp), &format!("kasperhermansen/{}:main-{}", self.bin_name, timestamp),
]) ])
.sync() };
.await?;
dep.sync().await?;
Ok(()) Ok(())
} }