From 770499b8ec696691357343ddccf90d3475199ab4 Mon Sep 17 00:00:00 2001 From: himeshr Date: Mon, 5 Feb 2024 12:50:02 +0530 Subject: [PATCH] avniproject/avni-product#1445 | Use master circleci config --- .circleci/config.yml | 53 +++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2bf630e..6890cea 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,7 @@ version: 2.1 +orbs: + aws-cli: circleci/aws-cli@4.1.1 + commands: deploy: description: "Deployment of rules server" @@ -62,6 +65,24 @@ commands: VAULT_PASSWORD_FILE=~/.vault-pass.txt app_zip_path=~/artifacts/ make rules-server-<< parameters.env >> - run: rm ~/.vault-pass.txt + setup_server_access: + description: Generate and copy temporary keys to server + parameters: + instance-id: + type: string + os-user: + type: string + default: ubuntu + availability-zone: + type: string + default: ap-south-1a + steps: + - run: rm -rf /tmp/temp_rsa_key* + - run: ssh-keygen -b 2048 -t rsa -f /tmp/temp_rsa_key -q -N "" + - run: eval `ssh-agent -s` + - run: ssh-add /tmp/temp_rsa_key + - run: | + aws ec2-instance-connect send-ssh-public-key --instance-id << parameters.instance-id >> --availability-zone << parameters.availability-zone >> --instance-os-user << parameters.os-user >> --no-paginate --ssh-public-key file:///tmp/temp_rsa_key.pub --output text | head -1 jobs: app_test: @@ -110,7 +131,7 @@ jobs: paths: - ./node_modules -# https://serverfault.com/questions/265675/how-can-i-zip-compress-a-symlink + # https://serverfault.com/questions/265675/how-can-i-zip-compress-a-symlink - run: zip --symlinks -r ~/rules-server.zip ../rules-server - run: tar -czvf ~/rules-server.tgz -C ../rules-server . @@ -132,7 +153,7 @@ jobs: - store_artifacts: path: ~/artifacts - + build_docker_image: docker: - image: docker:git @@ -198,20 +219,13 @@ jobs: steps: - deploy: hostname: "ssh.perf.openchs.org" - NEW_PRODUCTION_deploy: + PRODUCTION_deploy: docker: - image: cimg/deploy:2023.09-node working_directory: ~/ steps: - deploy_ansible: env: "prod" - PRODUCTION_deploy: - docker: - - image: cimg/node:10.24.1 - working_directory: ~/ - steps: - - deploy: - hostname: "ssh.server.openchs.org" RWB_STAGING_deploy: docker: - image: cimg/deploy:2023.09-node @@ -226,7 +240,7 @@ jobs: - deploy_ansible: env: "rwb-staging" - RWB_PROD_deploy: + RWB_PRODUCTION_deploy: docker: - image: cimg/deploy:2023.09-node working_directory: ~/ @@ -239,7 +253,7 @@ jobs: availability-zone: "ap-south-1a" - deploy_ansible: env: "rwb-prod" - + tags_filter: &tags_filter filters: tags: @@ -285,14 +299,6 @@ workflows: context: prod-deploy requires: - PRODUCTION_approve - - NEW_PRODUCTION_approve: - type: approval - requires: - - app_build - - NEW_PRODUCTION_deploy: - context: prod-deploy - requires: - - NEW_PRODUCTION_approve - PRERELEASE_approve: type: approval requires: @@ -319,16 +325,17 @@ workflows: - non-prod-deploy requires: - RWB_STAGING_approve - - RWB_PROD_approve: + - RWB_PRODUCTION_approve: type: approval requires: - app_build - - RWB_PROD_deploy: + - RWB_PRODUCTION_deploy: context: - RWB_AWS_OIDC - prod-deploy requires: - - RWB_PROD_approve + - RWB_PRODUCTION_approve + notify: webhooks: - url: https://webhooks.gitter.im/e/0fdffde721194986f2a0