From becb75fc79bde47a123446ebb88df41831561cc7 Mon Sep 17 00:00:00 2001 From: Aditya <60684641+0x0elliot@users.noreply.github.com> Date: Sun, 3 Nov 2024 16:28:34 +0530 Subject: [PATCH] fix: resort to the original registry during baseDeploy --- functions/onprem/worker/worker.go | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/functions/onprem/worker/worker.go b/functions/onprem/worker/worker.go index d652c1f9..b911ef98 100644 --- a/functions/onprem/worker/worker.go +++ b/functions/onprem/worker/worker.go @@ -423,8 +423,24 @@ func deployk8sApp(image string, identifier string, env []string) error { // value = strings.ReplaceAll(value, "_", "-") value := identifier + baseDeployMode := false + + // check if autoDeploy contains a value + // that is equal to the image being deployed. + for _, value := range autoDeploy { + if value == image { + log.Printf("[DEBUG] Detected baseDeploy image. Resorting to not using the registry") + baseDeployMode = true + } + } + + localRegistry := "" + // Checking if app is generated or not - localRegistry := os.Getenv("REGISTRY_URL") + if !baseDeployMode { + localRegistry := os.Getenv("REGISTRY_URL") + } + /* appDetails := strings.Split(image, ":")[1] appDetailsSplit := strings.Split(appDetails, "_") @@ -445,11 +461,11 @@ func deployk8sApp(image string, identifier string, env []string) error { } */ - if len(localRegistry) == 0 && len(os.Getenv("SHUFFLE_BASE_IMAGE_REGISTRY")) > 0 { + if (len(localRegistry) == 0 && len(os.Getenv("SHUFFLE_BASE_IMAGE_REGISTRY")) > 0) && !baseDeployMode { localRegistry = os.Getenv("SHUFFLE_BASE_IMAGE_REGISTRY") } - if len(localRegistry) > 0 && strings.Count(image, "/") <= 2 { + if (len(localRegistry) > 0 && strings.Count(image, "/") <= 2) { log.Printf("[DEBUG] Using REGISTRY_URL %s", localRegistry) image = fmt.Sprintf("%s/%s", localRegistry, image) } else {