From 071ac8ee78187fab8ffb7de135a982dc8636d9f6 Mon Sep 17 00:00:00 2001 From: Thibaud Brault Date: Wed, 3 May 2023 11:26:59 +0200 Subject: [PATCH 01/11] :green_heart: add prisma deploy service job --- .circleci/config.yml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 38c30df24..3102325da 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -139,7 +139,7 @@ jobs: paths: - client/build/ - prisma-deploy: + prisma-deploy-server: parameters: clever-app-id: type: string @@ -171,6 +171,17 @@ jobs: clever link << parameters.clever-app-id >> clever deploy --force + prisma-deploy-service: + executor: app-builder + steps: + - checkout + - node/install-packages: + app-dir: server + - run: + name: Deploy prisma + working_directory: server + command: node scripts/prisma_deploy_all/index.js + app-deploy: parameters: clever-app-id: @@ -222,11 +233,15 @@ workflows: - server-lint - client-lint - client-build - filters: - branches: - only: main - - prisma-deploy: + # filters: + # branches: + # only: main + - prisma-deploy-server: clever-app-id: app_f9c5c1cb-fe9c-41f9-a6c0-793e8326e95b context: clever-cloud-deployment requires: - app-deploy + - prisma-deploy-service: + context: faq-prisma-deployment + requires: + - prisma-deploy-server From 6ed66c34915a7af0d2837d702705b12318fb6f1d Mon Sep 17 00:00:00 2001 From: Thibaud Brault Date: Wed, 3 May 2023 11:28:53 +0200 Subject: [PATCH 02/11] :green_heart: fix indentation --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3102325da..f95a62633 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -242,6 +242,6 @@ workflows: requires: - app-deploy - prisma-deploy-service: - context: faq-prisma-deployment - requires: - - prisma-deploy-server + context: faq-prisma-deployment + requires: + - prisma-deploy-server From 5f26519dd343ed7266fceffe7e4715c31d3fa7b7 Mon Sep 17 00:00:00 2001 From: Thibaud Brault Date: Wed, 3 May 2023 11:45:24 +0200 Subject: [PATCH 03/11] :green_heart: modify command to start prisma deploy --- server/scripts/helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/scripts/helpers.js b/server/scripts/helpers.js index 709f593af..9d3090519 100644 --- a/server/scripts/helpers.js +++ b/server/scripts/helpers.js @@ -92,7 +92,7 @@ const queryManagement = gql => { // Implicit env required: PRISMA_URL, PRISMA_API_SECRET const deployPrismaService = (name, stage) => { const isForcing = process.argv.includes('--force') - run('prisma deploy ' + (isForcing ? '--force' : ''), { + run('npx prisma deploy ' + (isForcing ? '--force' : ''), { PRISMA_URL: process.env.PRISMA_URL + '/' + name + '/' + stage }) } From 420954d07c8f7c59d70af6e466b1b103975d365d Mon Sep 17 00:00:00 2001 From: Thibaud Brault Date: Wed, 3 May 2023 11:58:06 +0200 Subject: [PATCH 04/11] :green_heart: add force to prisma deploy --- .circleci/config.yml | 2 +- server/scripts/helpers.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f95a62633..0356ebeb5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -180,7 +180,7 @@ jobs: - run: name: Deploy prisma working_directory: server - command: node scripts/prisma_deploy_all/index.js + command: node scripts/prisma_deploy_all/index.js --force app-deploy: parameters: diff --git a/server/scripts/helpers.js b/server/scripts/helpers.js index 9d3090519..4cce2c4e4 100644 --- a/server/scripts/helpers.js +++ b/server/scripts/helpers.js @@ -92,7 +92,7 @@ const queryManagement = gql => { // Implicit env required: PRISMA_URL, PRISMA_API_SECRET const deployPrismaService = (name, stage) => { const isForcing = process.argv.includes('--force') - run('npx prisma deploy ' + (isForcing ? '--force' : ''), { + run('npx prisma deploy' + (isForcing ? '--force' : ''), { PRISMA_URL: process.env.PRISMA_URL + '/' + name + '/' + stage }) } From 1a90988e8349f6336a6a060821c035527cb82314 Mon Sep 17 00:00:00 2001 From: Thibaud Brault Date: Wed, 3 May 2023 12:04:09 +0200 Subject: [PATCH 05/11] :green_heart: rename test job to e2e-test --- .circleci/config.yml | 6 ++++-- server/scripts/helpers.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0356ebeb5..eaa2ce7f6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -84,7 +84,7 @@ jobs: - run: command: npm run prettier:check working_directory: e2e - test: + e2e-test: executor: e2e-runner steps: - checkout @@ -224,7 +224,7 @@ workflows: - server-lint - client-lint - e2e-lint - - test + - e2e-test - client-build - app-deploy: clever-app-id: app_c61407ae-b417-4406-86ed-cfd1acf84466 @@ -232,6 +232,8 @@ workflows: requires: - server-lint - client-lint + - e2e-lint + - e2e-test - client-build # filters: # branches: diff --git a/server/scripts/helpers.js b/server/scripts/helpers.js index 4cce2c4e4..9d3090519 100644 --- a/server/scripts/helpers.js +++ b/server/scripts/helpers.js @@ -92,7 +92,7 @@ const queryManagement = gql => { // Implicit env required: PRISMA_URL, PRISMA_API_SECRET const deployPrismaService = (name, stage) => { const isForcing = process.argv.includes('--force') - run('npx prisma deploy' + (isForcing ? '--force' : ''), { + run('npx prisma deploy ' + (isForcing ? '--force' : ''), { PRISMA_URL: process.env.PRISMA_URL + '/' + name + '/' + stage }) } From f54496194008df4dff8d7910ecd8bd6ee3c92443 Mon Sep 17 00:00:00 2001 From: Thibaud Brault Date: Wed, 3 May 2023 12:17:28 +0200 Subject: [PATCH 06/11] :green_heart: change path for prisma deploy script --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index eaa2ce7f6..cffdc8144 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -179,8 +179,8 @@ jobs: app-dir: server - run: name: Deploy prisma - working_directory: server - command: node scripts/prisma_deploy_all/index.js --force + working_directory: server/scripts/prisma_deploy_all/ + command: node index.js --force app-deploy: parameters: From ec57b116861053d1c806b2871ab00c55a24371f4 Mon Sep 17 00:00:00 2001 From: Thibaud Brault Date: Wed, 3 May 2023 12:26:51 +0200 Subject: [PATCH 07/11] :green_heart: add environment variables in client-build --- .circleci/config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index cffdc8144..52aac4186 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -134,6 +134,10 @@ jobs: - run: command: npm run build working_directory: client + environment: + REACT_APP_GRAPHQL_ENDPOINT: https://zenika.faq.team/gql + REACT_APP_REST_ENDPOINT: https://zenika.faq.team/rest + REACT_APP_FAQ_URL: faq.team - persist_to_workspace: root: . paths: From d4a3955f0f71a04af655d3e23d3d52c48af11531 Mon Sep 17 00:00:00 2001 From: Thibaud Brault Date: Wed, 3 May 2023 12:35:15 +0200 Subject: [PATCH 08/11] :green_heart: remove force for prisma deploy + put back branches filters --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 52aac4186..a22f87b1a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -184,7 +184,7 @@ jobs: - run: name: Deploy prisma working_directory: server/scripts/prisma_deploy_all/ - command: node index.js --force + command: node index.js app-deploy: parameters: @@ -239,9 +239,9 @@ workflows: - e2e-lint - e2e-test - client-build - # filters: - # branches: - # only: main + filters: + branches: + only: main - prisma-deploy-server: clever-app-id: app_f9c5c1cb-fe9c-41f9-a6c0-793e8326e95b context: clever-cloud-deployment From d324402f2e5d5f2179eb73db6d3f5d1fd55d7a25 Mon Sep 17 00:00:00 2001 From: Thibaud Brault Date: Wed, 3 May 2023 13:57:45 +0200 Subject: [PATCH 09/11] :green_heart: change graphql and rest endpoints url --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a22f87b1a..b7c21e436 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -135,8 +135,8 @@ jobs: command: npm run build working_directory: client environment: - REACT_APP_GRAPHQL_ENDPOINT: https://zenika.faq.team/gql - REACT_APP_REST_ENDPOINT: https://zenika.faq.team/rest + REACT_APP_GRAPHQL_ENDPOINT: /gql + REACT_APP_REST_ENDPOINT: /rest REACT_APP_FAQ_URL: faq.team - persist_to_workspace: root: . From 66983ad26ebf5fdfd0e13059107b300b242aab73 Mon Sep 17 00:00:00 2001 From: Thibaud Brault Date: Wed, 3 May 2023 13:59:43 +0200 Subject: [PATCH 10/11] :green_heart: remove branches filter for testing purpose --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b7c21e436..90766e356 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -184,7 +184,7 @@ jobs: - run: name: Deploy prisma working_directory: server/scripts/prisma_deploy_all/ - command: node index.js + command: node index.js --force app-deploy: parameters: @@ -239,9 +239,9 @@ workflows: - e2e-lint - e2e-test - client-build - filters: - branches: - only: main + # filters: + # branches: + # only: main - prisma-deploy-server: clever-app-id: app_f9c5c1cb-fe9c-41f9-a6c0-793e8326e95b context: clever-cloud-deployment From b55c315f38fa6fd376c88ce89e5c3321518cd35c Mon Sep 17 00:00:00 2001 From: Thibaud Brault Date: Wed, 3 May 2023 15:23:32 +0200 Subject: [PATCH 11/11] :green_heart: revert comment for branch filter + remove force for deploy --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 90766e356..b7c21e436 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -184,7 +184,7 @@ jobs: - run: name: Deploy prisma working_directory: server/scripts/prisma_deploy_all/ - command: node index.js --force + command: node index.js app-deploy: parameters: @@ -239,9 +239,9 @@ workflows: - e2e-lint - e2e-test - client-build - # filters: - # branches: - # only: main + filters: + branches: + only: main - prisma-deploy-server: clever-app-id: app_f9c5c1cb-fe9c-41f9-a6c0-793e8326e95b context: clever-cloud-deployment