Added base part to documentation to help with support

This commit is contained in:
frikky
2022-04-25 23:08:33 +02:00
parent 9cbef6752f
commit cb939fb59f
11 changed files with 190 additions and 99 deletions
+3
View File
@@ -13,6 +13,9 @@ COPY requirements.txt /requirements.txt
RUN pip install --prefix="/install" -r /requirements.txt
FROM base
RUN apt-get update
RUN apt-get dist-upgrade -y
RUN apt install build-essential libffi-dev musl-dev openssl python3 python3-pip -y
COPY --from=builder /install /usr/local
COPY __init__.py /app/walkoff_app_sdk/__init__.py
+1 -1
View File
@@ -273,7 +273,7 @@ class AppBase:
self.logger.warning(f"[INFO] Action result ran with Magic parser output.")
action_result["result"] = self.run_magic_parser(action_result["result"])
else:
self.logger.warning(f"[ERROR] Magic output not defined.")
self.logger.warning(f"[WARNING] Magic output not defined.")
except KeyError as e:
self.logger.warning(f"[DEBUG] Failed to run magic autoparser (send result) - keyerror: {e}")
except Exception as e:
+6 -2
View File
@@ -2,7 +2,7 @@
### DEFAULT
NAME=shuffle-app_sdk
VERSION=0.9.69
VERSION=0.9.70
docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force
docker build . -f Dockerfile -t frikky/shuffle:app_sdk -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION -t ghcr.io/frikky/$NAME:nightly
@@ -21,7 +21,11 @@ docker build . -f Dockerfile_ubuntu -t frikky/shuffle:app_sdk_ubuntu -t frikky/$
docker push frikky/shuffle:app_sdk_ubuntu
docker push ghcr.io/frikky/$NAME:$VERSION
#### Alpine GRPC
NAME=shuffle-app_sdk_grpc
docker build . -f Dockerfile_alpine_grpc -t frikky/shuffle:app_sdk_grpc -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION
docker push frikky/shuffle:app_sdk_grpc
docker push ghcr.io/frikky/$NAME:$VERSION
+15
View File
@@ -9,6 +9,7 @@ import (
"bytes"
"context"
"crypto/md5"
"strconv"
//"crypto/tls"
//"crypto/x509"
@@ -1029,6 +1030,7 @@ func handleInfo(resp http.ResponseWriter, request *http.Request) {
}
}
chatDisabled := false
if os.Getenv("SHUFFLE_CHAT_DISABLED") == "true" {
chatDisabled = true
}
@@ -4083,6 +4085,19 @@ func runInitEs(ctx context.Context) {
// FIXME: Have this for all envs in all orgs (loop and find).
if len(parsedApikey) > 0 {
cleanupSchedule := 300
if len(os.Getenv("SHUFFLE_RERUN_SCHEDULE")) > 0 {
newfrequency, err := strconv.Atoi(os.Getenv("SHUFFLE_RERUN_SCHEDULE"))
if err == nil {
cleanupSchedule = newfrequency
if cleanupSchedule < 300 {
log.Printf("[WARNING] A Cleanupschedule of less than 300 seconds won't help.")
cleanupSchedule = 300
}
}
}
environments := []string{"Shuffle"}
log.Printf("[DEBUG] Starting schedule setup for execution cleanup every %d seconds. Running first immediately.", cleanupSchedule)
cleanupJob := func() func() {
+5 -6
View File
@@ -321,8 +321,8 @@ func handleGetWorkflowqueue(resp http.ResponseWriter, request *http.Request) {
}
}
if len(executionRequests.Data) > 10 {
executionRequests.Data = executionRequests.Data[0:9]
if len(executionRequests.Data) > 50 {
executionRequests.Data = executionRequests.Data[0:49]
}
}
@@ -895,8 +895,8 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request
workflowExecution, execInfo, _, err := shuffle.PrepareWorkflowExecution(ctx, workflow, request, 10)
if err != nil {
log.Printf("[WARNING] Failed in prepareExecution: %s", err)
return shuffle.WorkflowExecution{}, fmt.Sprintf("Failed preparration: %s", err), err
log.Printf("[WARNING] Failed in prepareExecution for execution Id %s: %s", workflowExecution.ExecutionId, err)
return workflowExecution, fmt.Sprintf("Failed preparration: %s", err), err
}
err = imageCheckBuilder(execInfo.ImageNames)
@@ -1134,7 +1134,6 @@ func executeWorkflow(resp http.ResponseWriter, request *http.Request) {
user.ActiveOrg.Users = []shuffle.UserMini{}
workflow.ExecutingOrg = user.ActiveOrg
workflowExecution, executionResp, err := handleExecution(fileId, *workflow, request)
if err == nil {
resp.WriteHeader(200)
resp.Write([]byte(fmt.Sprintf(`{"success": true, "execution_id": "%s", "authorization": "%s"}`, workflowExecution.ExecutionId, workflowExecution.Authorization)))
@@ -1142,7 +1141,7 @@ func executeWorkflow(resp http.ResponseWriter, request *http.Request) {
}
resp.WriteHeader(500)
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "%s"}`, executionResp)))
resp.Write([]byte(fmt.Sprintf(`{"success": false, "execution_id": "%s", "authorization": "%s", "reason": "%s"}`, workflowExecution.ExecutionId, workflowExecution.Authorization, executionResp)))
}
func stopSchedule(resp http.ResponseWriter, request *http.Request) {