diff --git a/backend/go-app/main.go b/backend/go-app/main.go index c3987846..ef55cead 100644 --- a/backend/go-app/main.go +++ b/backend/go-app/main.go @@ -3535,7 +3535,7 @@ func handleWebhookCallback(resp http.ResponseWriter, request *http.Request) { } for _, item := range hook.Workflows { - log.Printf("Running webhook for workflow %s with startnode %s", item, hook.Start) + //log.Printf("Running webhook for workflow %s with startnode %s", item, hook.Start) workflow := Workflow{ ID: "", } diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index 0ef011a8..df426463 100644 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -1727,6 +1727,7 @@ func setNewWorkflow(resp http.ResponseWriter, request *http.Request) { action.IsValid = true } + action.LargeImage = "" newActions = append(newActions, action) } @@ -2797,7 +2798,18 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf if len(workflow.Actions) == 0 { workflow.Actions = []Action{} + } else { + newactions := []Action{} + for _, action := range workflow.Actions { + action.LargeImage = "" + action.SmallImage = "" + newactions = append(newactions, action) + log.Printf("ACTION: %#v", action) + } + + workflow.Actions = newactions } + if len(workflow.Branches) == 0 { workflow.Branches = []Branch{} } diff --git a/docker-compose.yml b/docker-compose.yml index 1846975b..2f3172f5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,8 @@ version: '3' services: frontend: - build: ./frontend - image: ghcr.io/frikky/shuffle-frontend:0.8.52 + #build: ./frontend + image: ghcr.io/frikky/shuffle-frontend:0.8.51 container_name: shuffle-frontend hostname: shuffle-frontend ports: diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index 2f0b127a..56279e64 100644 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -4479,10 +4479,14 @@ const AngularWorkflow = (props) => { setDestinationValue({}) }} > + + Conditions can't be used for loops [ .# ] Learn more + Condition + { @@ -4567,9 +4571,6 @@ const AngularWorkflow = (props) => { - - Conditions can't be used for loops [ .# ]. Learn more - { if (validate.valid) { if (typeof(validate.result) === "string") { - validate.result = JSON.parse(validate.result) + try { + validate.result = JSON.parse(validate.result) + } catch(e) { + console.log("Error: ", e) + validate.valid = false + } } return ( @@ -6514,10 +6520,19 @@ const AngularWorkflow = (props) => { const curapp = apps.find(a => a.name === data.action.app_name && a.app_version === data.action.app_version) const imgsize = 50 const statusColor = data.status === "FINISHED" || data.status === "SUCCESS" ? "green" : data.status === "ABORTED" || data.status === "FAILURE" ? "red" : "orange" + + var imgSrc = curapp === undefined ? "" : curapp.large_image + if (imgSrc.length === 0) { + // Look for the node in the workflow + const action = workflow.actions.find(action => action.id === data.action.id) + if (action !== undefined && action !== null) { + imgSrc = action.large_image + } + } var actionimg = curapp === null ? null : - + if (triggers.length > 2) { if (data.action.app_name === "shuffle-subflow") { @@ -7047,8 +7062,8 @@ const AngularWorkflow = (props) => { console.log("FIELDS: ", newFields) newAuthOption.fields = newFields setNewAppAuth(newAuthOption) - appAuthentication.push(newAuthOption) - setAppAuthentication(appAuthentication) + //appAuthentication.push(newAuthOption) + //setAppAuthentication(appAuthentication) getAppAuthentication() setUpdate(authenticationOption.id) diff --git a/frontend/src/views/Workflows.jsx b/frontend/src/views/Workflows.jsx index 1fdb7dae..40e5848a 100644 --- a/frontend/src/views/Workflows.jsx +++ b/frontend/src/views/Workflows.jsx @@ -68,6 +68,7 @@ export const validateJson = (showResult) => { } const result = jsonvalid ? JSON.parse(showResult) : showResult + //console.log("VALID: ", jsonvalid, result) return { "valid": jsonvalid, "result": result, diff --git a/functions/extensions/aws-lambda/deploy.sh b/functions/extensions/aws-lambda/deploy.sh new file mode 100644 index 00000000..a3187a27 --- /dev/null +++ b/functions/extensions/aws-lambda/deploy.sh @@ -0,0 +1,9 @@ +GOOS=linux go build main.go +zip function.zip main + +aws lambda update-function-code \ + --function-name shuffler-forwarder \ + --runtime go1.* \ + --zip-file fileb://function.zip \ + --handler main \ + --role arn:aws:iam::123456789012:role/execution_role diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index 5a7c0285..ba45fd40 100644 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -25,6 +25,8 @@ import ( "github.com/satori/go.uuid" //network "github.com/docker/docker/api/types/network" //natting "github.com/docker/go-connections/nat" + "github.com/mackerelio/go-osstat/cpu" + "github.com/mackerelio/go-osstat/memory" ) // Starts jobs in bulk, so this could be increased @@ -297,6 +299,41 @@ func initializeImages() { } } +// Will be used for checking if there's enough to deploy based on a threshold +// E.g. having maximum CPU and maxmimum RAM +// Does this work containerized? +func getStats() { + fmt.Printf("\n") + + memory, err := memory.Get() + if err != nil { + fmt.Fprintf(os.Stderr, "%s\n", err) + return + } + + fmt.Printf("[INFO] memory total: %d bytes\n", memory.Total) + fmt.Printf("[INFO] memory used: %d bytes\n", memory.Used) + + before, err := cpu.Get() + if err != nil { + fmt.Fprintf(os.Stderr, "%s\n", err) + return + } + time.Sleep(time.Duration(500) * time.Millisecond) + after, err := cpu.Get() + if err != nil { + fmt.Fprintf(os.Stderr, "%s\n", err) + return + } + total := float64(after.Total - before.Total) + + fmt.Printf("[INFO] cpu used : %f%%\n", float64(after.User-before.User)/total*100) + fmt.Printf("[INFO] cpu system: %f%%\n", float64(after.System-before.System)/total*100) + fmt.Printf("[INFO] cpu idle : %f%%\n", float64(after.Idle-before.Idle)/total*100) + + fmt.Printf("\n") +} + // Initial loop etc func main() { log.Println("[INFO] Setting up execution environment") @@ -371,6 +408,8 @@ func main() { }, } + getStats() + if (len(httpProxy) > 0 || len(httpsProxy) > 0) && baseUrl != "http://shuffle-backend:5001" { client = &http.Client{} } else { diff --git a/functions/onprem/worker/worker.go b/functions/onprem/worker/worker.go index 016ec96f..f43afeed 100644 --- a/functions/onprem/worker/worker.go +++ b/functions/onprem/worker/worker.go @@ -839,9 +839,10 @@ func shutdown(executionId, workflowId string) { log.Printf("[INFO] Failed abort request: %s", err) } - log.Printf("[INFO] Finished shutdown (after 15 seconds).") + sleepDuration := 0 + log.Printf("[INFO] Finished shutdown (after %d seconds).", sleepDuration) // Allows everything to finish in subprocesses - time.Sleep(time.Duration(15) * time.Second) + time.Sleep(time.Duration(sleepDuration) * time.Second) os.Exit(3) } @@ -862,9 +863,10 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env [] log.Printf("[WARNING] Empty self container id, continue without NetworkMode") } - if cleanupEnv == "true" { - hostConfig.AutoRemove = true - } + // Removing because log extraction should happen first + //if cleanupEnv == "true" { + // hostConfig.AutoRemove = true + //} config := &container.Config{ Image: image, @@ -892,7 +894,7 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env [] return err } - log.Printf("[INFO] Container %s is created for %s", cont.ID, identifier) + log.Printf("[INFO] Container %s was created for %s", cont.ID, identifier) containerIds = append(containerIds, cont.ID) return nil }