diff --git a/crates/cuddle-ci/src/rust_service.rs b/crates/cuddle-ci/src/rust_service.rs index 1050aa9..5ba065d 100644 --- a/crates/cuddle-ci/src/rust_service.rs +++ b/crates/cuddle-ci/src/rust_service.rs @@ -37,6 +37,7 @@ pub struct RustService { bin_name: String, arch: Option, os: Option, + deployment: bool, } impl From for RustService { @@ -51,6 +52,7 @@ impl From for RustService { bin_name: String::new(), arch: None, os: None, + deployment: true, } } } @@ -67,6 +69,7 @@ impl RustService { bin_name: String::new(), arch: None, os: None, + deployment: true, }) } @@ -115,6 +118,12 @@ impl RustService { self } + pub fn with_deployment(&mut self, deployment: bool) -> &mut Self { + self.deployment = deployment; + + self + } + fn get_src(&self) -> PathBuf { self.source .clone() @@ -339,50 +348,51 @@ impl MainAction for RustService { )) .await?; - let update_deployments_docker_image = - "docker.io/kasperhermansen/update-deployment:1701123940"; - let dep = self - .client - .container() - .from(update_deployments_docker_image); + if self.deployment { + let update_deployments_docker_image = + "docker.io/kasperhermansen/update-deployment:1701123940"; + let dep = self + .client + .container() + .from(update_deployments_docker_image); - 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)) - .with_env_variable("SSH_AUTH_SOCK", "/tmp/ssh_sock") - .with_exec(vec![ - "update-deployment", - "--repo", - &format!( - "git@git.front.kjuulh.io:kjuulh/{}-deployment.git", - self.bin_name - ), - "--service", - &self.bin_name, - "--image", - &format!("kasperhermansen/{}:main-{}", self.bin_name, timestamp), - ]) - } else { - dep.with_env_variable("GIT_USERNAME", "kjuulh") - .with_env_variable( - "GIT_PASSWORD", - std::env::var("GIT_PASSWORD").expect("GIT_PASSWORD to be set"), - ) - .with_exec(vec![ - "update-deployment", - "--repo", - &format!( - "https://git.front.kjuulh.io/kjuulh/{}-deployment.git", - self.bin_name - ), - "--service", - &self.bin_name, - "--image", - &format!("kasperhermansen/{}:main-{}", self.bin_name, timestamp), - ]) - }; - - dep.sync().await?; + let dep = if let Ok(sock) = std::env::var("SSH_AUTH_SOCK") { + dep.with_unix_socket("/tmp/ssh_sock", self.client.host().unix_socket(sock)) + .with_env_variable("SSH_AUTH_SOCK", "/tmp/ssh_sock") + .with_exec(vec![ + "update-deployment", + "--repo", + &format!( + "git@git.front.kjuulh.io:kjuulh/{}-deployment.git", + self.bin_name + ), + "--service", + &self.bin_name, + "--image", + &format!("kasperhermansen/{}:main-{}", self.bin_name, timestamp), + ]) + } else { + dep.with_env_variable("GIT_USERNAME", "kjuulh") + .with_env_variable( + "GIT_PASSWORD", + std::env::var("GIT_PASSWORD").expect("GIT_PASSWORD to be set"), + ) + .with_exec(vec![ + "update-deployment", + "--repo", + &format!( + "https://git.front.kjuulh.io/kjuulh/{}-deployment.git", + self.bin_name + ), + "--service", + &self.bin_name, + "--image", + &format!("kasperhermansen/{}:main-{}", self.bin_name, timestamp), + ]) + }; + dep.sync().await?; + } Ok(()) } }