Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- version: 2.1
- orbs:
- aws-cli: circleci/aws-cli@0.1.11
- aws-ecr: circleci/aws-ecr@0.0.4
- aws-ecs: circleci/aws-ecs@0.0.6
- jobs:
- build-job:
- working_directory: ~/app
- docker:
- - image: 'circleci/node:10.15.1'
- steps:
- - checkout
- # Download and cache dependencies
- - restore_cache:
- keys:
- - v2-dep-{{ .Branch }}-{{ checksum "package.json" }}
- # fallback to using the latest cache if no exact match is found
- - v2-dep-
- - run: make install
- - run: make build
- - run: make test
- - save_cache:
- paths:
- - node_modules
- key: v2-dep-{{ .Branch }}-{{ checksum "package.json" }}
- - save_cache:
- paths:
- - dist
- key: v2-dep-{{ .Branch }}-{{ checksum "package.json" }}-{{ .Revision }}
- # Deploy to s3 (currently not using)
- deploy-s3-job:
- docker:
- - image: 'circleci/node:10.15.1'
- - image: 'circleci/python:3.7'
- working_directory: ~/app
- steps:
- - checkout
- # Download and cache dependencies
- - run:
- name: Install Dependencies
- command: |`
- printf "[default]\naccess_key = $AWS_ACCESS_KEY_ID\nsecret_key = $AWS_SECRET_ACCESS_KEY" >> ~/.s3cfg
- mkdir ~/.aws
- printf "[default]\naws_access_key_id = $AWS_ACCESS_KEY_ID\naws_secret_access_key = $AWS_SECRET_ACCESS_KEY" >> ~/.aws/credentials
- sudo apt-get update
- sudo apt install s3cmd -y
- - restore_cache:
- keys:
- - v2-dep-{{ .Branch }}-{{ checksum "package.json" }}-{{ .Revision }}
- - run:
- name: Deploy
- command: |
- make s3upload
- verify-deployment:
- docker:
- - image: 'circleci/python:3.7.1'
- steps:
- - aws-cli/install
- - aws-cli/configure
- - run:
- name: Get last task definition
- command: >
- TASK_DEFINITION_ARN=$(aws ecs describe-task-definition \
- --task-definition ${APP_PREFIX}-service \
- --output text \
- --query 'taskDefinition.taskDefinitionArn')
- echo "export TASK_DEFINITION_ARN='${TASK_DEFINITION_ARN}'" >>
- $BASH_ENV
- - aws-ecs/verify-revision-is-deployed:
- family: '${APP_PREFIX}-service'
- cluster-name: '${APP_PREFIX}'
- task-definition-arn: '${TASK_DEFINITION_ARN}'
- workflows:
- version: 2.1
- build-deploy:
- jobs:
- - build-job
- - aws-ecr/build_and_push_image:
- requires:
- - build-job
- account-url: '${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com'
- repo: '${APP_PREFIX}'
- region: '${AWS_REGION}'
- tag: '${CIRCLE_SHA1}'
- filters:
- branches:
- only: deployments
- - aws-ecs/deploy-service-update:
- requires:
- - aws-ecr/build_and_push_image
- family: '${APP_PREFIX}-service'
- cluster-name: '${APP_PREFIX}'
- container-image-name-updates: 'container=${APP_PREFIX},tag=${CIRCLE_SHA1}'
- filters:
- branches:
- only: deployments
- - verify-deployment:
- requires:
- - aws-ecs/deploy-service-update
- filters:
- branches:
- only: deployments
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement