Merge pull request #1420 from Shuffle/0x0elliot/user-input-fix

fix[user-input]: making it work for onprem
This commit is contained in:
Aditya
2024-06-05 16:28:22 +05:30
committed by GitHub
2 changed files with 11 additions and 7 deletions
+3 -1
View File
@@ -20,7 +20,7 @@ require (
github.com/gorilla/mux v1.8.1 github.com/gorilla/mux v1.8.1
github.com/h2non/filetype v1.1.3 github.com/h2non/filetype v1.1.3
github.com/satori/go.uuid v1.2.0 github.com/satori/go.uuid v1.2.0
github.com/shuffle/shuffle-shared v0.6.31 github.com/shuffle/shuffle-shared v0.6.40
golang.org/x/crypto v0.22.0 golang.org/x/crypto v0.22.0
google.golang.org/api v0.176.1 google.golang.org/api v0.176.1
google.golang.org/grpc v1.63.2 google.golang.org/grpc v1.63.2
@@ -76,6 +76,7 @@ require (
github.com/google/uuid v1.6.0 // indirect github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.3 // 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/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/josharian/intern v1.0.0 // indirect github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // 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/sirupsen/logrus v1.9.3 // indirect
github.com/skeema/knownhosts v1.2.2 // indirect github.com/skeema/knownhosts v1.2.2 // indirect
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // 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/src-d/gcfg v1.4.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect
go.opencensus.io v0.24.0 // indirect go.opencensus.io v0.24.0 // indirect
+8 -6
View File
@@ -578,6 +578,7 @@ func handleGetStreamResults(resp http.ResponseWriter, request *http.Request) {
if len(actionResult.ExecutionId) > 0 { if len(actionResult.ExecutionId) > 0 {
log.Printf("[WARNING][%s] Failed getting execution (streamresult): %s", actionResult.ExecutionId, err) log.Printf("[WARNING][%s] Failed getting execution (streamresult): %s", actionResult.ExecutionId, err)
} }
resp.WriteHeader(401) resp.WriteHeader(401)
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Bad authorization key or execution_id might not exist."}`))) resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Bad authorization key or execution_id might not exist."}`)))
return return
@@ -1056,16 +1057,17 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request
} }
} }
workflowExecution, execInfo, _, err := shuffle.PrepareWorkflowExecution(ctx, workflow, request, int64(maxExecutionDepth)) workflowExecution, execInfo, _, workflowExecErr := shuffle.PrepareWorkflowExecution(ctx, workflow, request, int64(maxExecutionDepth))
if err != nil { if workflowExecErr != nil {
err = shuffle.SetWorkflowExecution(ctx, workflowExecution, true) err := shuffle.SetWorkflowExecution(ctx, workflowExecution, true)
if err != nil { if err != nil {
log.Printf("[ERROR] Failed setting workflow execution during init (2): %s", err) 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 // Special for user input callbacks
return workflowExecution, fmt.Sprintf("%s", err), nil log.Printf("[INFO] User input callback: %s", workflowExecErr)
// return workflowExecution, fmt.Sprintf("%s", err), nil
} else { } else {
log.Printf("[ERROR] Failed in prepareExecution: '%s'", err) log.Printf("[ERROR] Failed in prepareExecution: '%s'", err)
return shuffle.WorkflowExecution{}, fmt.Sprintf("Failed starting workflow: %s", err), err return shuffle.WorkflowExecution{}, fmt.Sprintf("Failed starting workflow: %s", err), err
@@ -1073,7 +1075,7 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request
} }
err = imageCheckBuilder(execInfo.ImageNames) err := imageCheckBuilder(execInfo.ImageNames)
if err != nil { if err != nil {
log.Printf("[ERROR] Failed building the required images from %#v: %s", execInfo.ImageNames, err) log.Printf("[ERROR] Failed building the required images from %#v: %s", execInfo.ImageNames, err)
return shuffle.WorkflowExecution{}, "Failed unmarshal during execution", err return shuffle.WorkflowExecution{}, "Failed unmarshal during execution", err