From 56a240bc187428b42804dd0062c86ebda14c61d2 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Fri, 15 Dec 2023 09:53:48 +0000 Subject: [PATCH 1/4] Set up DD version and code tracking. --- packages/server/Dockerfile | 4 ++++ packages/worker/Dockerfile | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/packages/server/Dockerfile b/packages/server/Dockerfile index f737570fcd..2af37ae288 100644 --- a/packages/server/Dockerfile +++ b/packages/server/Dockerfile @@ -68,9 +68,13 @@ COPY packages/server/builder/ builder/ COPY packages/server/client/ client/ ARG BUDIBASE_VERSION +ARG GIT_COMMIT_SHA # Ensuring the version argument is sent RUN test -n "$BUDIBASE_VERSION" ENV BUDIBASE_VERSION=$BUDIBASE_VERSION +ENV DD_GIT_REPOSITORY_URL=https://github.com/budibase/budibase +ENV DD_GIT_COMMIT_SHA=$GIT_COMMIT_SHA +ENV DD_VERSION=$BUDIBASE_VERSION EXPOSE 4001 diff --git a/packages/worker/Dockerfile b/packages/worker/Dockerfile index 4706ca155a..b03a817c8b 100644 --- a/packages/worker/Dockerfile +++ b/packages/worker/Dockerfile @@ -51,8 +51,12 @@ ENV TENANT_FEATURE_FLAGS=*:LICENSING,*:USER_GROUPS,*:ONBOARDING_TOUR ENV ACCOUNT_PORTAL_URL=https://account.budibase.app ARG BUDIBASE_VERSION +ARG GIT_COMMIT_SHA # Ensuring the version argument is sent RUN test -n "$BUDIBASE_VERSION" ENV BUDIBASE_VERSION=$BUDIBASE_VERSION +ENV DD_GIT_REPOSITORY_URL=https://github.com/budibase/budibase +ENV DD_GIT_COMMIT_SHA=$GIT_COMMIT_SHA +ENV DD_VERSION=$BUDIBASE_VERSION CMD ["./docker_run.sh"] From 61d360b8c9b9cd3429d4a89fc26901935b916901 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Fri, 15 Dec 2023 14:41:06 +0000 Subject: [PATCH 2/4] Bump version to 2.13.44 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 0ed2de613f..7462903994 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.13.43", + "version": "2.13.44", "npmClient": "yarn", "packages": [ "packages/*", From 92a230667fcd3ae71759c570bcc3463dae5a976d Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Fri, 15 Dec 2023 16:27:20 +0000 Subject: [PATCH 3/4] Tell a user if their JS failed due to a timeout. --- packages/string-templates/src/helpers/javascript.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/string-templates/src/helpers/javascript.js b/packages/string-templates/src/helpers/javascript.js index c5996c25f0..d757408780 100644 --- a/packages/string-templates/src/helpers/javascript.js +++ b/packages/string-templates/src/helpers/javascript.js @@ -56,6 +56,9 @@ module.exports.processJS = (handlebars, context) => { const res = { data: runJS(js, sandboxContext) } return `{{${LITERAL_MARKER} js_result-${JSON.stringify(res)}}}` } catch (error) { + if (error.code === "ERR_SCRIPT_EXECUTION_TIMEOUT") { + return "Timed out while executing JS" + } return "Error while executing JS" } } From b963e7081e55e5dab19433ad5a9204d96f7fb5b8 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Fri, 15 Dec 2023 16:50:36 +0000 Subject: [PATCH 4/4] Fix test. --- packages/string-templates/src/helpers/javascript.js | 1 + packages/string-templates/test/javascript.spec.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/string-templates/src/helpers/javascript.js b/packages/string-templates/src/helpers/javascript.js index d757408780..53baec8613 100644 --- a/packages/string-templates/src/helpers/javascript.js +++ b/packages/string-templates/src/helpers/javascript.js @@ -56,6 +56,7 @@ module.exports.processJS = (handlebars, context) => { const res = { data: runJS(js, sandboxContext) } return `{{${LITERAL_MARKER} js_result-${JSON.stringify(res)}}}` } catch (error) { + console.log(`JS error: ${typeof error} ${JSON.stringify(error)}`) if (error.code === "ERR_SCRIPT_EXECUTION_TIMEOUT") { return "Timed out while executing JS" } diff --git a/packages/string-templates/test/javascript.spec.js b/packages/string-templates/test/javascript.spec.js index bbc1cce246..652f7ac1cd 100644 --- a/packages/string-templates/test/javascript.spec.js +++ b/packages/string-templates/test/javascript.spec.js @@ -114,7 +114,7 @@ describe("Test the JavaScript helper", () => { it("should timeout after one second", () => { const output = processJS(`while (true) {}`) - expect(output).toBe("Error while executing JS") + expect(output).toBe("Timed out while executing JS") }) it("should prevent access to the process global", () => {