From a2e4d37eeaa81fece73aaa804bd0456e7dc4938d Mon Sep 17 00:00:00 2001 From: Frikky Date: Mon, 24 Mar 2025 20:59:44 +0100 Subject: [PATCH] Allowed workflow reruns from a specific node --- backend/go-app/docker.go | 10 +++++++++- backend/go-app/walkoff.go | 11 +++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/backend/go-app/docker.go b/backend/go-app/docker.go index 11bbe14d..e56455eb 100755 --- a/backend/go-app/docker.go +++ b/backend/go-app/docker.go @@ -647,7 +647,15 @@ func getDockerImage(resp http.ResponseWriter, request *http.Request) { alternativeName = strings.Join(alternativeNameSplit[1:3], "/") } - log.Printf("[INFO] Trying to download image: %s. Alt: %s", version.Name, alternativeName) + if len(version.Name) == 0 { + log.Printf("[ERROR] No image name provided for download: %s", version.Name) + resp.WriteHeader(401) + resp.Write([]byte(fmt.Sprintf(`{"success": false, "message": "No image name"}`))) + return + + } + + log.Printf("[INFO] Trying to download image: '%s'. Alt name: %#v", version.Name, alternativeName) for _, image := range images { for _, tag := range image.RepoTags { diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index 434b5a42..93540aa8 100755 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -3041,9 +3041,16 @@ func executeSingleAction(resp http.ResponseWriter, request *http.Request) { return } - time.Sleep(2 * time.Second) - log.Printf("[INFO] Starting validation of execution %s", workflowExecution.ExecutionId) + if shouldRerun { + log.Printf("[DEBUG] Returning single action execution ID for rerun: %s", workflowExecution.ExecutionId) + resp.WriteHeader(200) + resp.Write([]byte(fmt.Sprintf(`{"success": true, "execution_id": "%s", "authorization": "%s"}`, workflowExecution.ExecutionId, workflowExecution.Authorization))) + return + } + + log.Printf("[INFO] Starting validation of execution %s", workflowExecution.ExecutionId) + time.Sleep(2 * time.Second) returnBody := shuffle.HandleRetValidation(ctx, workflowExecution, 1) returnBytes, err := json.Marshal(returnBody) if err != nil {