Fixed webhook

This commit is contained in:
frikky
2020-05-14 10:43:05 +02:00
parent 809a1824ff
commit 33f6d85e09
3 changed files with 31 additions and 12 deletions
+5 -5
View File
@@ -774,7 +774,7 @@ func handleWorkflowQueue(resp http.ResponseWriter, request *http.Request) {
}
}
log.Printf("Checking results %d vs %d", len(workflowExecution.Results), len(workflowExecution.Workflow.Actions)+extraInputs)
//log.Printf("Checking results %d vs %d", len(workflowExecution.Results), len(workflowExecution.Workflow.Actions)+extraInputs)
if len(workflowExecution.Results) == len(workflowExecution.Workflow.Actions)+extraInputs {
finished := true
for _, result := range workflowExecution.Results {
@@ -1611,7 +1611,6 @@ func cleanupExecutions(resp http.ResponseWriter, request *http.Request) {
func handleExecution(id string, workflow Workflow, request *http.Request) (WorkflowExecution, string, error) {
ctx := context.Background()
if workflow.ID == "" || workflow.ID != id {
log.Printf("UPDATING WORKFLOW")
tmpworkflow, err := getWorkflow(ctx, id)
if err != nil {
log.Printf("Failed getting the workflow locally: %s", err)
@@ -1668,6 +1667,10 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
return WorkflowExecution{}, "", err
}
if execution.Start == "" && len(body) > 0 {
execution.ExecutionArgument = string(body)
}
// FIXME - this should have "execution_argument" from executeWorkflow frontend
if len(execution.ExecutionArgument) > 0 {
workflowExecution.ExecutionArgument = execution.ExecutionArgument
@@ -1835,7 +1838,6 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
onpremExecution := false
environments := []string{}
for _, action := range workflowExecution.Workflow.Actions {
log.Printf("ENV: %#v", action.Environment)
if action.Environment != cloudname {
found := false
for _, env := range environments {
@@ -1859,8 +1861,6 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
return WorkflowExecution{}, "Failed getting workflowexecution", err
}
log.Printf("Environments: %#v", environments)
// Adds queue for onprem execution
// FIXME - add specifics to executionRequest, e.g. specific environment (can run multi onprem)
if onpremExecution {