From b332276d20af493684135089c02605d665ddaf7a Mon Sep 17 00:00:00 2001 From: yashsinghcodes Date: Wed, 6 Aug 2025 04:09:52 +0530 Subject: [PATCH 1/2] keep context of downloaded images --- functions/onprem/worker/worker.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/functions/onprem/worker/worker.go b/functions/onprem/worker/worker.go index 2fbf51e3..5c31f7e3 100644 --- a/functions/onprem/worker/worker.go +++ b/functions/onprem/worker/worker.go @@ -840,7 +840,10 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env [] // Running as coroutine for eventual completeness // FIXME: With goroutines it got too much trouble of deploying with an older version // Allowing slow startups, as long as it's eventually fast, and uses the same registry as on host. - shuffle.DownloadDockerImageBackend(&http.Client{Timeout: imagedownloadTimeout}, image) + err := shuffle.DownloadDockerImageBackend(&http.Client{Timeout: imagedownloadTimeout}, image) + if err == nil { + downloadedImages = append(downloadedImages, image) + } } var exposedPort int @@ -1598,6 +1601,7 @@ func handleExecutionResult(workflowExecution shuffle.WorkflowExecution) { executed := false if err == nil { log.Printf("[DEBUG] Downloaded image %s from backend (CLEANUP)", imageName) + downloadedImages = append(downloadedImages, imageName) //err = deployApp(dockercli, image, identifier, env, workflow, action) err = deployApp(dockercli, imageName, identifier, env, workflowExecution, action) if err != nil && !strings.Contains(err.Error(), "Conflict. The container name") { @@ -1712,6 +1716,7 @@ func handleExecutionResult(workflowExecution shuffle.WorkflowExecution) { executed := false if err == nil { log.Printf("[DEBUG] Downloaded image %s from backend (CLEANUP)", imageName) + downloadedImages = append(downloadedImages, imageName) //err = deployApp(dockercli, image, identifier, env, workflow, action) err = deployApp(dockercli, imageName, identifier, env, workflowExecution, action) if err != nil && !strings.Contains(err.Error(), "Conflict. The container name") { @@ -4415,7 +4420,10 @@ func handleDownloadImage(resp http.ResponseWriter, request *http.Request) { } log.Printf("[INFO] Downloading image %s", imageBody.Image) - shuffle.DownloadDockerImageBackend(&http.Client{Timeout: imagedownloadTimeout}, imageBody.Image) + err = shuffle.DownloadDockerImageBackend(&http.Client{Timeout: imagedownloadTimeout}, imageBody.Image) + if err == nil { + downloadedImages = append(downloadedImages, imageBody.Image) + } // return success resp.WriteHeader(200) From 4f98b583a423bb1a2200a4bfc8121ed0f862cd5f Mon Sep 17 00:00:00 2001 From: yashsinghcodes Date: Thu, 7 Aug 2025 23:04:38 +0530 Subject: [PATCH 2/2] fixing some old bugs --- backend/go-app/walkoff.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index eb174870..c7d3658d 100755 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -309,10 +309,10 @@ func handleGetWorkflowqueue(resp http.ResponseWriter, request *http.Request) { } if !found { - log.Printf("[ERROR] Failed to find environment(%s) for org(%s)", environment, orgId) - resp.WriteHeader(400) - resp.Write([]byte(`{"success":false,"reason":"environment not found"}`)) - return + env, err = shuffle.GetEnvironment(ctx, environment, "") + if err != nil { + log.Printf("[WARNING] Failed to find the environment(%s) in org(%s). Could cause with Failover test", environment, orgId) + } } timeNow := time.Now().Unix()