From a42e815fd46b005154737bc26c3ec3e6a25a518b Mon Sep 17 00:00:00 2001 From: frikky Date: Mon, 11 Apr 2022 16:56:34 +0200 Subject: [PATCH] Not sending auth key in webhook callbacks anymore --- backend/go-app/go.mod | 2 +- backend/go-app/main.go | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/backend/go-app/go.mod b/backend/go-app/go.mod index 19cd1694..5e590eed 100644 --- a/backend/go-app/go.mod +++ b/backend/go-app/go.mod @@ -24,7 +24,7 @@ require ( github.com/h2non/filetype v1.1.3 github.com/nirasan/go-oauth-pkce-code-verifier v0.0.0-20170819232839-0fbfe93532da // indirect github.com/satori/go.uuid v1.2.0 - github.com/shuffle/shuffle-shared v0.2.27 + github.com/shuffle/shuffle-shared v0.2.28 go4.org v0.0.0-20201209231011-d4a079459e60 // indirect golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce google.golang.org/api v0.65.0 diff --git a/backend/go-app/main.go b/backend/go-app/main.go index b49817da..f70e1618 100644 --- a/backend/go-app/main.go +++ b/backend/go-app/main.go @@ -2247,7 +2247,7 @@ func handleWebhookCallback(resp http.ResponseWriter, request *http.Request) { */ resp.WriteHeader(200) - resp.Write([]byte(fmt.Sprintf(`{"success": true, "execution_id": "%s", "authorization": "%s"}`, workflowExecution.ExecutionId, workflowExecution.Authorization))) + resp.Write([]byte(fmt.Sprintf(`{"success": true, "execution_id": "%s"}`, workflowExecution.ExecutionId))) return } @@ -3237,14 +3237,6 @@ func buildSwaggerApp(resp http.ResponseWriter, body []byte, user shuffle.User) { fmt.Sprintf("%s:%s", baseDockerName, versionName), } - err = buildImage(dockerTags, dockerLocation) - if err != nil { - log.Printf("[ERROR] Docker build error: %s", err) - resp.WriteHeader(500) - resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Error in Docker build: %s"}`, err))) - return - } - found := false foundNumber := 0 log.Printf("[INFO] Checking for api with ID %s", newmd5) @@ -3328,6 +3320,16 @@ func buildSwaggerApp(resp http.ResponseWriter, body []byte, user shuffle.User) { shuffle.DeleteCache(ctx, cacheKey) shuffle.DeleteCache(ctx, fmt.Sprintf("apps_%s", user.Id)) + // Doing this last to ensure we can copy the docker image over + // even though builds fail + err = buildImage(dockerTags, dockerLocation) + if err != nil { + log.Printf("[ERROR] Docker build error: %s", err) + resp.WriteHeader(500) + resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Error in Docker build: %s"}`, err))) + return + } + log.Printf("[DEBUG] Successfully built app %s (%s)", api.Name, api.ID) if len(user.Id) > 0 { resp.WriteHeader(200)