From 7a02d5dc96b399d013b9a21fff686d745f18fb1f Mon Sep 17 00:00:00 2001 From: emidhun Date: Tue, 29 Apr 2025 06:28:20 +0530 Subject: [PATCH 1/8] Modify the actions files --- .../workflows/{ => cypress}/code-coverage.yml | 0 .../{ => cypress}/cypress-appbuilder.yml | 94 ++----------------- .../{ => cypress}/cypress-marketplace.yml | 15 ++- .../{ => cypress}/cypress-platform.yml | 11 +-- 4 files changed, 15 insertions(+), 105 deletions(-) rename .github/workflows/{ => cypress}/code-coverage.yml (100%) rename .github/workflows/{ => cypress}/cypress-appbuilder.yml (63%) rename .github/workflows/{ => cypress}/cypress-marketplace.yml (95%) rename .github/workflows/{ => cypress}/cypress-platform.yml (99%) diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/cypress/code-coverage.yml similarity index 100% rename from .github/workflows/code-coverage.yml rename to .github/workflows/cypress/code-coverage.yml diff --git a/.github/workflows/cypress-appbuilder.yml b/.github/workflows/cypress/cypress-appbuilder.yml similarity index 63% rename from .github/workflows/cypress-appbuilder.yml rename to .github/workflows/cypress/cypress-appbuilder.yml index 3e9be3f560..94a9b44efc 100644 --- a/.github/workflows/cypress-appbuilder.yml +++ b/.github/workflows/cypress/cypress-appbuilder.yml @@ -12,22 +12,16 @@ env: jobs: Cypress-App-Builder: runs-on: ubuntu-22.04 - - if: | - github.event.action == 'labeled' && - ( - github.event.label.name == 'run-cypress' || - github.event.label.name == 'run-ce-app-builder' || - github.event.label.name == 'run-ee-app-builder' - ) - + if: contains(github.event.pull_request.labels.*.name, 'run-ce-app-builder') || + contains(github.event.pull_request.labels.*.name, 'run-ee-app-builder') || + contains(github.event.pull_request.labels.*.name, 'run-cypress') strategy: matrix: edition: >- ${{ - contains(github.event.pull_request.labels.*.name, 'run-cypress') && fromJson('["ce", "ee"]') || contains(github.event.pull_request.labels.*.name, 'run-ce-app-builder') && fromJson('["ce"]') || contains(github.event.pull_request.labels.*.name, 'run-ee-app-builder') && fromJson('["ee"]') || + contains(github.event.pull_request.labels.*.name, 'run-cypress') && fromJson('["ce", "ee"]') || fromJson('[]') }} @@ -164,8 +158,8 @@ jobs: Cypress-App-builder-Subpath: runs-on: ubuntu-22.04 - - if: ${{ github.event.action == 'labeled' && github.event.label.name == 'run-cypress-app-builder-subpath' }} + if: contains(github.event.pull_request.labels.*.name, 'run-cypress') || + contains(github.event.pull_request.labels.*.name, 'run-cypress-app-builder-subpath') steps: - name: Checkout @@ -173,82 +167,6 @@ jobs: with: ref: ${{ github.event.pull_request.head.ref }} - # Create Docker Buildx builder with platform configuration - - name: Set up Docker Buildx - run: | - mkdir -p ~/.docker/cli-plugins - curl -SL https://github.com/docker/buildx/releases/download/v0.11.0/buildx-v0.11.0.linux-amd64 -o ~/.docker/cli-plugins/docker-buildx - chmod a+x ~/.docker/cli-plugins/docker-buildx - docker buildx create --name mybuilder --platform linux/arm64,linux/amd64,linux/amd64/v2,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6 - docker buildx use mybuilder - - - name: Set DOCKER_CLI_EXPERIMENTAL - run: echo "DOCKER_CLI_EXPERIMENTAL=enabled" >> $GITHUB_ENV - - - name: use mybuilder buildx - run: docker buildx use mybuilder - - - name: Build docker image - run: docker buildx build --platform=linux/amd64 -f docker/production.Dockerfile . -t tooljet/tj-osv:cypressplaform - - - name: Set up environment variables - run: | - echo "TOOLJET_HOST=http://localhost:3000" >> .env - echo "LOCKBOX_MASTER_KEY=cd97331a419c09387bef49787f7da8d2a81d30733f0de6bed23ad8356d2068b2" >> .env - echo "SECRET_KEY_BASE=7073b9a35a15dd20914ae17e36a693093f25b74b96517a5fec461fc901c51e011cd142c731bee48c5081ec8bac321c1f259ef097ef2a16f25df17a3798c03426" >> .env - echo "PG_DB=tooljet_development" >> .env - echo "PG_USER=postgres" >> .env - echo "PG_HOST=postgres" >> .env - echo "PG_PASS=postgres" >> .env - echo "PG_PORT=5432" >> .env - echo "ENABLE_TOOLJET_DB=true" >> .env - echo "TOOLJET_DB=tooljet_db" >> .env - echo "TOOLJET_DB_USER=postgres" >> .env - echo "TOOLJET_DB_HOST=postgres" >> .env - echo "TOOLJET_DB_PASS=postgres" >> .env - echo "PGRST_JWT_SECRET=r9iMKoe5CRMgvJBBtp4HrqN7QiPpUToj" >> .env - echo "PGRST_HOST=postgrest" >> .env - echo "PGRST_DB_URI=postgres://postgres:postgres@postgres/tooljet_db" >> .env - echo "SSO_GIT_OAUTH2_CLIENT_ID=dummy" >> .env - echo "SSO_GIT_OAUTH2_CLIENT_SECRET=dummy" >> .env - echo "SSO_GIT_OAUTH2_HOST=dummy" >> .env - echo "SSO_GOOGLE_OAUTH2_CLIENT_ID=dummy" >> .env - echo "SUB_PATH=/apps/tooljet/" >> .env - echo "NODE_ENV=production" >> .env - echo "SERVE_CLIENT=true" >> .env - echo "ENABLE_PRIVATE_APP_EMBED=true" >> .env - - - name: Pulling the docker-compose file - run: curl -LO https://tooljet-test.s3.us-west-1.amazonaws.com/docker-compose.yaml && mkdir postgres_data - - - name: Run docker-compose file - run: docker-compose up -d - - - name: Checking containers - run: docker ps -a - - - name: docker logs - run: sudo docker logs Tooljet-app - - - name: Wait for the server to be ready - run: | - timeout 1500 bash -c ' - until curl --silent --fail http://localhost:80/apps/tooljet/; do - sleep 5 - done' - - - name: Seeding (Setup Super Admin) - run: | - curl 'http://localhost:3000/api/onboarding/setup-super-admin' \ - -H 'Content-Type: application/json' \ - --data-raw '{ - "companyName": "ToolJet",, - "name": "The Developer", - "workspaceName": "Tooljet'\''s workspace", - "email": "dev@tooljet.io", - "password": "password" - }' - - name: Create Cypress environment file id: create-json uses: jsdaniell/create-json@1.1.2 diff --git a/.github/workflows/cypress-marketplace.yml b/.github/workflows/cypress/cypress-marketplace.yml similarity index 95% rename from .github/workflows/cypress-marketplace.yml rename to .github/workflows/cypress/cypress-marketplace.yml index 19368195a6..ee1fba239e 100644 --- a/.github/workflows/cypress-marketplace.yml +++ b/.github/workflows/cypress/cypress-marketplace.yml @@ -14,13 +14,9 @@ jobs: Cypress-Marketplace: runs-on: ubuntu-22.04 - if: | - github.event.action == 'labeled' && - ( - github.event.label.name == 'run-cypress' || - github.event.label.name == 'run-ce-cypress-marketplace' || - github.event.label.name == 'run-ee-cypress-marketplace' - ) + if: contains(github.event.pull_request.labels.*.name, 'run-cypress') || + contains(github.event.pull_request.labels.*.name, 'run-ce-cypress-marketplace') || + contains(github.event.pull_request.labels.*.name, 'run-ee-cypress-marketplace') strategy: matrix: @@ -44,7 +40,7 @@ jobs: mkdir -p ~/.docker/cli-plugins curl -SL https://github.com/docker/buildx/releases/download/v0.11.0/buildx-v0.11.0.linux-amd64 -o ~/.docker/cli-plugins/docker-buildx chmod a+x ~/.docker/cli-plugins/docker-buildx - docker buildx create --name mybuilder --platform linux/arm64,linux/amd64,linux/amd64/v2,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6 + docker buildx create --name mybuilder --platform linux/arm64,linux/amd64 docker buildx use mybuilder - name: Set DOCKER_CLI_EXPERIMENTAL @@ -189,7 +185,8 @@ jobs: Cypress-Marketplace-Subpath: runs-on: ubuntu-22.04 - if: ${{ github.event.action == 'labeled' && github.event.label.name == 'run-cypress-marketplace-subpath' }} + if: contains(github.event.pull_request.labels.*.name, 'run-cypress') || + contains(github.event.pull_request.labels.*.name, 'run-cypress-marketplace-subpath') steps: - name: Checkout diff --git a/.github/workflows/cypress-platform.yml b/.github/workflows/cypress/cypress-platform.yml similarity index 99% rename from .github/workflows/cypress-platform.yml rename to .github/workflows/cypress/cypress-platform.yml index 3dbacafc06..01852784de 100644 --- a/.github/workflows/cypress-platform.yml +++ b/.github/workflows/cypress/cypress-platform.yml @@ -12,14 +12,9 @@ env: jobs: Cypress-Platform: runs-on: ubuntu-22.04 - if: | - github.event.action == 'labeled' && - ( - github.event.label.name == 'run-cypress' || - github.event.label.name == 'run-ce-cypress-platform' || - github.event.label.name == 'run-ee-cypress-platform' - ) - + if: contains(github.event.pull_request.labels.*.name, 'run-cypress') || + contains(github.event.pull_request.labels.*.name, 'run-ce-cypress-platform') || + contains(github.event.pull_request.labels.*.name, 'run-ee-cypress-platform') strategy: matrix: edition: >- From cf7d82284dab05d0561b0ecc0c852766bed3ee9e Mon Sep 17 00:00:00 2001 From: emidhun Date: Tue, 29 Apr 2025 06:32:48 +0530 Subject: [PATCH 2/8] dummy changes --- .../appbuilder/commonTestcases/components/buttonHappyPath.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress-tests/cypress/e2e/happyPath/appbuilder/commonTestcases/components/buttonHappyPath.cy.js b/cypress-tests/cypress/e2e/happyPath/appbuilder/commonTestcases/components/buttonHappyPath.cy.js index 67be49e530..acc65395f7 100644 --- a/cypress-tests/cypress/e2e/happyPath/appbuilder/commonTestcases/components/buttonHappyPath.cy.js +++ b/cypress-tests/cypress/e2e/happyPath/appbuilder/commonTestcases/components/buttonHappyPath.cy.js @@ -32,7 +32,7 @@ import { addSupportCSAData, } from "Support/utils/events"; -describe("Editor- Test Button widget", () => { +describe("Editor- Test Button widget ", () => { beforeEach(() => { cy.apiLogin(); cy.apiCreateApp(`${fake.companyName}-button-App`); From fbe0d3fc799e32548ec2e12ab2d91f5857eedebb Mon Sep 17 00:00:00 2001 From: emidhun Date: Tue, 29 Apr 2025 10:42:20 +0530 Subject: [PATCH 3/8] dummy changes --- .github/workflows/cypress/cypress-appbuilder.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cypress/cypress-appbuilder.yml b/.github/workflows/cypress/cypress-appbuilder.yml index 94a9b44efc..90b1b2dd2d 100644 --- a/.github/workflows/cypress/cypress-appbuilder.yml +++ b/.github/workflows/cypress/cypress-appbuilder.yml @@ -12,9 +12,13 @@ env: jobs: Cypress-App-Builder: runs-on: ubuntu-22.04 - if: contains(github.event.pull_request.labels.*.name, 'run-ce-app-builder') || - contains(github.event.pull_request.labels.*.name, 'run-ee-app-builder') || - contains(github.event.pull_request.labels.*.name, 'run-cypress') + # if: | + # contains(github.event.pull_request.labels.*.name, 'run-ce-app-builder') || + # contains(github.event.pull_request.labels.*.name, 'run-ee-app-builder') || + # contains(github.event.pull_request.labels.*.name, 'run-cypress') + steps: + - name: Log all labels + run: echo "Labels: ${{ toJson(github.event.pull_request.labels.*.name) }}" strategy: matrix: edition: >- From 3cb98f1b6b9260a460ff73e25204044fea909b6b Mon Sep 17 00:00:00 2001 From: emidhun Date: Tue, 29 Apr 2025 10:46:46 +0530 Subject: [PATCH 4/8] dummy changes-revert --- .github/workflows/{cypress => }/code-coverage.yml | 0 .github/workflows/{cypress => }/cypress-appbuilder.yml | 0 .github/workflows/{cypress => }/cypress-marketplace.yml | 0 .github/workflows/{cypress => }/cypress-platform.yml | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{cypress => }/code-coverage.yml (100%) rename .github/workflows/{cypress => }/cypress-appbuilder.yml (100%) rename .github/workflows/{cypress => }/cypress-marketplace.yml (100%) rename .github/workflows/{cypress => }/cypress-platform.yml (100%) diff --git a/.github/workflows/cypress/code-coverage.yml b/.github/workflows/code-coverage.yml similarity index 100% rename from .github/workflows/cypress/code-coverage.yml rename to .github/workflows/code-coverage.yml diff --git a/.github/workflows/cypress/cypress-appbuilder.yml b/.github/workflows/cypress-appbuilder.yml similarity index 100% rename from .github/workflows/cypress/cypress-appbuilder.yml rename to .github/workflows/cypress-appbuilder.yml diff --git a/.github/workflows/cypress/cypress-marketplace.yml b/.github/workflows/cypress-marketplace.yml similarity index 100% rename from .github/workflows/cypress/cypress-marketplace.yml rename to .github/workflows/cypress-marketplace.yml diff --git a/.github/workflows/cypress/cypress-platform.yml b/.github/workflows/cypress-platform.yml similarity index 100% rename from .github/workflows/cypress/cypress-platform.yml rename to .github/workflows/cypress-platform.yml From 5eede75ea1130e81dd0d015a62f771a209e0a25b Mon Sep 17 00:00:00 2001 From: emidhun Date: Tue, 29 Apr 2025 10:55:07 +0530 Subject: [PATCH 5/8] Add trigger only on adding label --- .github/workflows/cypress-appbuilder.yml | 14 ++++++-------- .github/workflows/cypress-marketplace.yml | 2 +- .github/workflows/cypress-platform.yml | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cypress-appbuilder.yml b/.github/workflows/cypress-appbuilder.yml index 90b1b2dd2d..67eb0ae432 100644 --- a/.github/workflows/cypress-appbuilder.yml +++ b/.github/workflows/cypress-appbuilder.yml @@ -2,7 +2,7 @@ name: Cypress App-Builder on: pull_request_target: - types: [labeled, unlabeled, closed] + types: [labeled] workflow_dispatch: env: @@ -12,13 +12,11 @@ env: jobs: Cypress-App-Builder: runs-on: ubuntu-22.04 - # if: | - # contains(github.event.pull_request.labels.*.name, 'run-ce-app-builder') || - # contains(github.event.pull_request.labels.*.name, 'run-ee-app-builder') || - # contains(github.event.pull_request.labels.*.name, 'run-cypress') - steps: - - name: Log all labels - run: echo "Labels: ${{ toJson(github.event.pull_request.labels.*.name) }}" + if: | + contains(github.event.pull_request.labels.*.name, 'run-ce-app-builder') || + contains(github.event.pull_request.labels.*.name, 'run-ee-app-builder') || + contains(github.event.pull_request.labels.*.name, 'run-cypress') + strategy: matrix: edition: >- diff --git a/.github/workflows/cypress-marketplace.yml b/.github/workflows/cypress-marketplace.yml index ee1fba239e..4d34523219 100644 --- a/.github/workflows/cypress-marketplace.yml +++ b/.github/workflows/cypress-marketplace.yml @@ -2,7 +2,7 @@ name: Cypress Marketplace on: pull_request_target: - types: [labeled, unlabeled, closed] + types: [labeled] workflow_dispatch: diff --git a/.github/workflows/cypress-platform.yml b/.github/workflows/cypress-platform.yml index 01852784de..0480db39f9 100644 --- a/.github/workflows/cypress-platform.yml +++ b/.github/workflows/cypress-platform.yml @@ -2,7 +2,7 @@ name: Cypress Platform on: pull_request_target: - types: [labeled, unlabeled, closed] + types: [labeled] workflow_dispatch: env: From e94abd830e44eb52adadb9539a73772a6b868496 Mon Sep 17 00:00:00 2001 From: emidhun Date: Tue, 29 Apr 2025 12:31:01 +0530 Subject: [PATCH 6/8] Comment flaky spec --- .../workspace/groups/{permissions.cy.js => permissions.skip.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename cypress-tests/cypress/e2e/happyPath/platform/commonTestcases/workspace/groups/{permissions.cy.js => permissions.skip.js} (100%) diff --git a/cypress-tests/cypress/e2e/happyPath/platform/commonTestcases/workspace/groups/permissions.cy.js b/cypress-tests/cypress/e2e/happyPath/platform/commonTestcases/workspace/groups/permissions.skip.js similarity index 100% rename from cypress-tests/cypress/e2e/happyPath/platform/commonTestcases/workspace/groups/permissions.cy.js rename to cypress-tests/cypress/e2e/happyPath/platform/commonTestcases/workspace/groups/permissions.skip.js From 7c6f3c576df0a2f33d6a4b5c47d23effa59b5c67 Mon Sep 17 00:00:00 2001 From: devanshu052000 Date: Tue, 29 Apr 2025 16:05:23 +0530 Subject: [PATCH 7/8] Move page-permissions logic to server/ee submodule --- server/ee | 2 +- .../versions/services/create.service.ts | 42 +------------------ 2 files changed, 2 insertions(+), 42 deletions(-) diff --git a/server/ee b/server/ee index 84ec48d0f6..30512fbfc2 160000 --- a/server/ee +++ b/server/ee @@ -1 +1 @@ -Subproject commit 84ec48d0f64fd6dc5f7677f71a5119219cc4ada4 +Subproject commit 30512fbfc2633b2eacc49666993b2c27a61b3327 diff --git a/server/src/modules/versions/services/create.service.ts b/server/src/modules/versions/services/create.service.ts index 94b7f9783c..12a24ac7c6 100644 --- a/server/src/modules/versions/services/create.service.ts +++ b/server/src/modules/versions/services/create.service.ts @@ -6,7 +6,7 @@ import { DataSource } from '@entities/data_source.entity'; import { DataSourceOptions } from '@entities/data_source_options.entity'; import { EventHandler, Target } from '@entities/event_handler.entity'; import { dbTransactionWrap } from '@helpers/database.helper'; -import { EntityManager, In } from 'typeorm'; +import { EntityManager } from 'typeorm'; import { Credential } from 'src/entities/credential.entity'; import * as uuid from 'uuid'; import { Page } from '@entities/page.entity'; @@ -22,8 +22,6 @@ import { DataSourcesRepository } from '@modules/data-sources/repository'; import { DataQueryRepository } from '@modules/data-queries/repository'; import { AppEnvironmentUtilService } from '@modules/app-environments/util.service'; import { IVersionsCreateService } from '../interfaces/services/ICreateService'; -import { PagePermission } from '@entities/page_permissions.entity'; -import { PageUser } from '@entities/page_users.entity'; @Injectable() export class VersionsCreateService implements IVersionsCreateService { @@ -403,44 +401,6 @@ export class VersionsCreateService implements IVersionsCreateService { homePageId = savedPage.id; } - const oldPermissions = await manager.find(PagePermission, { - where: { pageId: page.id }, - }); - - const newPermissions = oldPermissions.map((permission) => { - return manager.create(PagePermission, { - ...permission, - id: undefined, - pageId: oldPageToNewPageMapping[permission.pageId], - }); - }); - - await manager.save(PagePermission, newPermissions); - - const permissionIdMap = new Map(); - oldPermissions.forEach((oldPerm, index) => { - const newPerm = newPermissions[index]; - permissionIdMap.set(oldPerm.id, newPerm.id); - }); - - const oldPermissionIds = oldPermissions.map((p) => p.id); - - const oldPageUsers = await manager.find(PageUser, { - where: { - pagePermissionsId: In(oldPermissionIds), - }, - }); - - const newPageUsers = oldPageUsers.map((pu) => - manager.create(PageUser, { - ...pu, - id: undefined, - pagePermissionsId: permissionIdMap.get(pu.pagePermissionsId), - }) - ); - - await manager.save(PageUser, newPageUsers); - const pageEvents = allEvents.filter((event) => event.sourceId === page.id); pageEvents.forEach(async (event, index) => { From c62c0f7ff956ef058e1997bb0d416b6f43ec24f0 Mon Sep 17 00:00:00 2001 From: johnsoncherian Date: Tue, 29 Apr 2025 18:17:23 +0530 Subject: [PATCH 8/8] chore: uodate submodule reference --- server/ee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/ee b/server/ee index 30512fbfc2..b9e73f87b9 160000 --- a/server/ee +++ b/server/ee @@ -1 +1 @@ -Subproject commit 30512fbfc2633b2eacc49666993b2c27a61b3327 +Subproject commit b9e73f87b9062e06c49c2c73add6b82ba21dcacf