From e759ef51b5552b0fe373374704b68d273e25edf4 Mon Sep 17 00:00:00 2001 From: Aditya <60684641+0x0elliot@users.noreply.github.com> Date: Mon, 3 Jun 2024 23:04:33 +0530 Subject: [PATCH 1/5] fix[user-input]: making it work for onprem --- backend/go-app/walkoff.go | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index 10df25b2..698d5c80 100755 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -577,6 +577,8 @@ func handleGetStreamResults(resp http.ResponseWriter, request *http.Request) { if err != nil { if len(actionResult.ExecutionId) > 0 { log.Printf("[WARNING][%s] Failed getting execution (streamresult): %s", actionResult.ExecutionId, err) + } else { + log.Printf("[WARNING] Execution ID is empty in stream result") } resp.WriteHeader(401) resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Bad authorization key or execution_id might not exist."}`))) @@ -1056,24 +1058,29 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request } } - workflowExecution, execInfo, _, err := shuffle.PrepareWorkflowExecution(ctx, workflow, request, int64(maxExecutionDepth)) - if err != nil { - err = shuffle.SetWorkflowExecution(ctx, workflowExecution, true) + workflowExecution, execInfo, _, workflowExecErr := shuffle.PrepareWorkflowExecution(ctx, workflow, request, int64(maxExecutionDepth)) + if workflowExecErr != nil { + err := shuffle.SetWorkflowExecution(ctx, workflowExecution, true) if err != nil { log.Printf("[ERROR] Failed setting workflow execution during init (2): %s", err) } - if strings.Contains(fmt.Sprintf("%s", err), "User Input") { + if strings.Contains(fmt.Sprintf("%s", workflowExecErr), "User Input") { // Special for user input callbacks - return workflowExecution, fmt.Sprintf("%s", err), nil + log.Printf("[INFO] User input callback: %s", err) + // return workflowExecution, fmt.Sprintf("%s", err), nil } else { + if err == nil && workflowExecErr != nil { + err = workflowExecErr + } + log.Printf("[ERROR] Failed in prepareExecution: '%s'", err) return shuffle.WorkflowExecution{}, fmt.Sprintf("Failed starting workflow: %s", err), err } } - err = imageCheckBuilder(execInfo.ImageNames) + err := imageCheckBuilder(execInfo.ImageNames) if err != nil { log.Printf("[ERROR] Failed building the required images from %#v: %s", execInfo.ImageNames, err) return shuffle.WorkflowExecution{}, "Failed unmarshal during execution", err @@ -1336,6 +1343,17 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request } } + // check if previous result.action.app_name was shuffle-subflow + if len(workflowExecution.Results) > 0 { + lastResult := workflowExecution.Results[len(workflowExecution.Results)-1] + if lastResult.Action.AppName == "shuffle-subflow" { + log.Printf("LAST RESULT: %s", lastResult.Action.AppName) + + // newStartnode = "a4b01316-2d6d-4b25-9560-2f5586e1a770" + } + } + + if !startnodeFound { log.Printf("[INFO] Couldn't find startnode %s. Remapping to %#v", workflowExecution.Start, newStartnode) @@ -1346,6 +1364,8 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request } } + log.Printf("[INFO] Starting execution on %s", workflowExecution.Start) + childNodes := shuffle.FindChildNodes(workflowExecution, workflowExecution.Start, []string{}, []string{}) startFound := false From 08fb90f41b089ecf1b4448622aff323019225fc8 Mon Sep 17 00:00:00 2001 From: Aditya <60684641+0x0elliot@users.noreply.github.com> Date: Mon, 3 Jun 2024 23:35:32 +0530 Subject: [PATCH 2/5] chore: upgrading shuffle-shared from v0.6.31 to v0.6.39 --- backend/go-app/go.mod | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/go-app/go.mod b/backend/go-app/go.mod index 4895bf22..b6e052da 100644 --- a/backend/go-app/go.mod +++ b/backend/go-app/go.mod @@ -20,7 +20,7 @@ require ( github.com/gorilla/mux v1.8.1 github.com/h2non/filetype v1.1.3 github.com/satori/go.uuid v1.2.0 - github.com/shuffle/shuffle-shared v0.6.31 + github.com/shuffle/shuffle-shared v0.6.39 golang.org/x/crypto v0.22.0 google.golang.org/api v0.176.1 google.golang.org/grpc v1.63.2 @@ -76,6 +76,7 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.3 // indirect + github.com/imdario/mergo v0.3.12 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -103,6 +104,7 @@ require ( github.com/sirupsen/logrus v1.9.3 // indirect github.com/skeema/knownhosts v1.2.2 // indirect github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // indirect + github.com/spf13/pflag v1.0.5 // indirect github.com/src-d/gcfg v1.4.0 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect go.opencensus.io v0.24.0 // indirect From 65db168ae2c62fdabd1810ad2a244086f82342c9 Mon Sep 17 00:00:00 2001 From: Aditya <60684641+0x0elliot@users.noreply.github.com> Date: Mon, 3 Jun 2024 23:56:50 +0530 Subject: [PATCH 3/5] fix[user-input]: removing unnecessary code --- backend/go-app/walkoff.go | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index 698d5c80..b213aab6 100755 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -577,9 +577,8 @@ func handleGetStreamResults(resp http.ResponseWriter, request *http.Request) { if err != nil { if len(actionResult.ExecutionId) > 0 { log.Printf("[WARNING][%s] Failed getting execution (streamresult): %s", actionResult.ExecutionId, err) - } else { - log.Printf("[WARNING] Execution ID is empty in stream result") } + resp.WriteHeader(401) resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Bad authorization key or execution_id might not exist."}`))) return @@ -1058,29 +1057,25 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request } } - workflowExecution, execInfo, _, workflowExecErr := shuffle.PrepareWorkflowExecution(ctx, workflow, request, int64(maxExecutionDepth)) - if workflowExecErr != nil { - err := shuffle.SetWorkflowExecution(ctx, workflowExecution, true) + workflowExecution, execInfo, _, err := shuffle.PrepareWorkflowExecution(ctx, workflow, request, int64(maxExecutionDepth)) + if err != nil { + err = shuffle.SetWorkflowExecution(ctx, workflowExecution, true) if err != nil { log.Printf("[ERROR] Failed setting workflow execution during init (2): %s", err) } - if strings.Contains(fmt.Sprintf("%s", workflowExecErr), "User Input") { + if strings.Contains(fmt.Sprintf("%s", err), "User Input") { // Special for user input callbacks log.Printf("[INFO] User input callback: %s", err) - // return workflowExecution, fmt.Sprintf("%s", err), nil + return workflowExecution, fmt.Sprintf("%s", err), nil } else { - if err == nil && workflowExecErr != nil { - err = workflowExecErr - } - log.Printf("[ERROR] Failed in prepareExecution: '%s'", err) return shuffle.WorkflowExecution{}, fmt.Sprintf("Failed starting workflow: %s", err), err } } - err := imageCheckBuilder(execInfo.ImageNames) + err = imageCheckBuilder(execInfo.ImageNames) if err != nil { log.Printf("[ERROR] Failed building the required images from %#v: %s", execInfo.ImageNames, err) return shuffle.WorkflowExecution{}, "Failed unmarshal during execution", err @@ -1343,17 +1338,6 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request } } - // check if previous result.action.app_name was shuffle-subflow - if len(workflowExecution.Results) > 0 { - lastResult := workflowExecution.Results[len(workflowExecution.Results)-1] - if lastResult.Action.AppName == "shuffle-subflow" { - log.Printf("LAST RESULT: %s", lastResult.Action.AppName) - - // newStartnode = "a4b01316-2d6d-4b25-9560-2f5586e1a770" - } - } - - if !startnodeFound { log.Printf("[INFO] Couldn't find startnode %s. Remapping to %#v", workflowExecution.Start, newStartnode) @@ -1364,8 +1348,6 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request } } - log.Printf("[INFO] Starting execution on %s", workflowExecution.Start) - childNodes := shuffle.FindChildNodes(workflowExecution, workflowExecution.Start, []string{}, []string{}) startFound := false From e465d5343f76504f8276f1d14005a76ec7c5d572 Mon Sep 17 00:00:00 2001 From: Aditya <60684641+0x0elliot@users.noreply.github.com> Date: Tue, 4 Jun 2024 00:34:50 +0530 Subject: [PATCH 4/5] fix[user-input]: removing unnecessary code --- backend/go-app/walkoff.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index b213aab6..4caac5bc 100755 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -1057,17 +1057,17 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request } } - workflowExecution, execInfo, _, err := shuffle.PrepareWorkflowExecution(ctx, workflow, request, int64(maxExecutionDepth)) - if err != nil { - err = shuffle.SetWorkflowExecution(ctx, workflowExecution, true) + workflowExecution, execInfo, _, workflowExecErr := shuffle.PrepareWorkflowExecution(ctx, workflow, request, int64(maxExecutionDepth)) + if workflowExecErr != nil { + err := shuffle.SetWorkflowExecution(ctx, workflowExecution, true) if err != nil { log.Printf("[ERROR] Failed setting workflow execution during init (2): %s", err) } - if strings.Contains(fmt.Sprintf("%s", err), "User Input") { + if strings.Contains(fmt.Sprintf("%s", workflowExecErr), "User Input") { // Special for user input callbacks - log.Printf("[INFO] User input callback: %s", err) - return workflowExecution, fmt.Sprintf("%s", err), nil + log.Printf("[INFO] User input callback: %s", workflowExecErr) + // return workflowExecution, fmt.Sprintf("%s", err), nil } else { log.Printf("[ERROR] Failed in prepareExecution: '%s'", err) return shuffle.WorkflowExecution{}, fmt.Sprintf("Failed starting workflow: %s", err), err @@ -1075,7 +1075,7 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request } - err = imageCheckBuilder(execInfo.ImageNames) + err := imageCheckBuilder(execInfo.ImageNames) if err != nil { log.Printf("[ERROR] Failed building the required images from %#v: %s", execInfo.ImageNames, err) return shuffle.WorkflowExecution{}, "Failed unmarshal during execution", err From 024f3be99957aec6e89fc99fe2fd83af0681b181 Mon Sep 17 00:00:00 2001 From: Aditya <60684641+0x0elliot@users.noreply.github.com> Date: Tue, 4 Jun 2024 00:36:36 +0530 Subject: [PATCH 5/5] chore: upgrading shuffle-shared from v0.6.39 to v0.6.40 --- backend/go-app/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/go-app/go.mod b/backend/go-app/go.mod index b6e052da..659f6364 100644 --- a/backend/go-app/go.mod +++ b/backend/go-app/go.mod @@ -20,7 +20,7 @@ require ( github.com/gorilla/mux v1.8.1 github.com/h2non/filetype v1.1.3 github.com/satori/go.uuid v1.2.0 - github.com/shuffle/shuffle-shared v0.6.39 + github.com/shuffle/shuffle-shared v0.6.40 golang.org/x/crypto v0.22.0 google.golang.org/api v0.176.1 google.golang.org/grpc v1.63.2