From 695abb3dbad1550521ec81f755ff929d2b645aca Mon Sep 17 00:00:00 2001 From: mahboobeh Date: Wed, 27 May 2020 11:07:53 +0800 Subject: [PATCH 1/6] add new deploy script to standardize FE releases --- .circleci/config.yml | 86 ++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 04655c9378..e4fd850c96 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,6 @@ version: 2.1 orbs: k8s: circleci/kubernetes@0.7.0 - s3: circleci/aws-s3@1.0.13 commands: git_checkout_from_cache: description: "Git checkout and save cache" @@ -53,38 +52,31 @@ commands: - run: name: "yarn build" command: node_modules/gulp/bin/gulp.js build-min - compress: - description: "Compress" + deploy: + description: "Deploy to static branches" + parameters: + target_branch: + type: string steps: + - checkout + - attach_workspace: + at: www - run: - name: "Compress" + name: Tag build + command: echo "<< parameters.target_branch >> $(date)" > www/version + - run: + name: Install and configure dependencies command: | - pushd www/ - tar -cvf artifact.tar * - mv artifact.tar ${OLDPWD}/ + sudo npm install -g gh-pages@2.0.1 + git config user.email "ci-build@binary.com" + git config user.name "ci-build" + - add_ssh_keys: + fingerprints: + - "95:22:af:3a:82:d8:21:a5:e1:d9:79:52:89:50:2f:17" - run: - name: "Tag commit id as artifact identifer" - command: echo "${CIRCLE_SHA1}" > artifact-info.txt - upload_artifact: - description: "upload artifact to s3" - steps: - - s3/copy: - from: artifact.tar - to: 's3://${CONTEXT_ARTIFACT_S3_BUCKET}/${CIRCLE_PROJECT_REPONAME}/' - aws-access-key-id: env_CONTEXT_ARTIFACT_S3_AWS_ACCESS_KEY_ID - aws-secret-access-key: env_CONTEXT_ARTIFACT_S3_AWS_SECRET_ACCESS_KEY - aws-region: env_CONTEXT_ARTIFACT_S3_AWS_REGION - arguments: '--metadata "{\"x-amz-artifact-id\": \"${CIRCLE_SHA1}\" }"' - upload_checksum: - description: "upload artifact commit id to s3" - steps: - - s3/copy: - from: artifact-info.txt - to: 's3://${CONTEXT_ARTIFACT_S3_BUCKET}/${CIRCLE_PROJECT_REPONAME}/' - aws-access-key-id: env_CONTEXT_ARTIFACT_S3_AWS_ACCESS_KEY_ID - aws-secret-access-key: env_CONTEXT_ARTIFACT_S3_AWS_SECRET_ACCESS_KEY - aws-region: env_CONTEXT_ARTIFACT_S3_AWS_REGION - docker: + name: Deploy docs to gh-pages branch + command: gh-pages -d www --branch << parameters.target_branch >> + docker_build_push: description: "Build and Push image to docker hub" parameters: target: @@ -130,7 +122,7 @@ commands: fi done - npm_test: + test: description: Run test steps: - run: @@ -145,30 +137,35 @@ jobs: steps: - git_checkout_from_cache - npm_install - - npm_test + - test release_beta: docker: - - image: circleci/node:12.13.0-stretch + - image: circleci/node:8.10.0-stretch steps: - git_checkout_from_cache - npm_install - build - - docker: - target: "beta" - - k8s_deploy: - target: "beta" + - deploy: + target_branch: "staging" release_production: + docker: + - image: circleci/node:8.10.0-stretch + steps: + - git_checkout_from_cache + - npm_install + - build + - deploy: + target_branch: "production" + + release_aws_production: docker: - image: circleci/node:12.13.0-stretch steps: - git_checkout_from_cache - npm_install - build - - compress - - upload_artifact # uploading the built code to s3 to create a backup of key services separate from Kubernetes deployment - - upload_checksum # uploading compressed artifact checksum to cross match artifact fingerprint before actual deployment - docker: target: "production" - k8s_deploy: @@ -180,17 +177,20 @@ workflows: - test release: jobs: - - release_beta: + release_beta: + filters: + branches: + only: /^master$/ + - release_production: filters: branches: ignore: /.*/ tags: - only: /^beta.*/ - context: binary-frontend-artifact-upload + only: /^production.*/ - release_production: filters: branches: ignore: /.*/ tags: - only: /^production.*/ + only: /^aws\-production.*/ context: binary-frontend-artifact-upload From 31d42cd589b8b23972f2ee5fbffe904b07da7476 Mon Sep 17 00:00:00 2001 From: mahboobeh Date: Wed, 27 May 2020 11:11:08 +0800 Subject: [PATCH 2/6] Update .circleci/config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e4fd850c96..53f53c439b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -177,7 +177,7 @@ workflows: - test release: jobs: - release_beta: + - release_beta: filters: branches: only: /^master$/ From d54b171fafa35fdaba71922576c09ee8f16ff20f Mon Sep 17 00:00:00 2001 From: mahboobeh Date: Wed, 27 May 2020 11:12:40 +0800 Subject: [PATCH 3/6] Update .circleci/config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 53f53c439b..f2c81d1acd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -177,7 +177,7 @@ workflows: - test release: jobs: - - release_beta: + - release_beta: filters: branches: only: /^master$/ From 70b4129fd3677b8553b7b8f617bc73da80395b11 Mon Sep 17 00:00:00 2001 From: mahboobeh Date: Fri, 29 May 2020 16:11:36 +0800 Subject: [PATCH 4/6] updae ci user key --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f2c81d1acd..1b9b7399e4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -72,7 +72,7 @@ commands: git config user.name "ci-build" - add_ssh_keys: fingerprints: - - "95:22:af:3a:82:d8:21:a5:e1:d9:79:52:89:50:2f:17" + - "01:67:4a:6d:26:9c:70:c4:1a:60:91:88:d9:dd:f0:83" - run: name: Deploy docs to gh-pages branch command: gh-pages -d www --branch << parameters.target_branch >> From dcf644a344f6494063ac4a36f019b994205783e6 Mon Sep 17 00:00:00 2001 From: mahboobeh Date: Wed, 17 Jun 2020 09:52:10 +0800 Subject: [PATCH 5/6] update ssh key --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1b9b7399e4..aa15ad92ec 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -72,7 +72,7 @@ commands: git config user.name "ci-build" - add_ssh_keys: fingerprints: - - "01:67:4a:6d:26:9c:70:c4:1a:60:91:88:d9:dd:f0:83" + - "c5:a7:d0:64:8d:7c:44:f7:6c:84:a9:b2:67:3e:9d:00" - run: name: Deploy docs to gh-pages branch command: gh-pages -d www --branch << parameters.target_branch >> @@ -192,5 +192,5 @@ workflows: branches: ignore: /.*/ tags: - only: /^aws\-production.*/ + only: /^production.*/ context: binary-frontend-artifact-upload From b3d7220b9f1641c1df877529382599e91eb403f0 Mon Sep 17 00:00:00 2001 From: mahboobeh Date: Wed, 17 Jun 2020 10:03:15 +0800 Subject: [PATCH 6/6] skip CI for static branches --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index aa15ad92ec..b4b979aa93 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -75,7 +75,7 @@ commands: - "c5:a7:d0:64:8d:7c:44:f7:6c:84:a9:b2:67:3e:9d:00" - run: name: Deploy docs to gh-pages branch - command: gh-pages -d www --branch << parameters.target_branch >> + command: gh-pages -d www --branch << parameters.target_branch >> --message '[skip ci]' docker_build_push: description: "Build and Push image to docker hub" parameters: