|
1 | 1 | version: 2
|
| 2 | +defaults: &defaults |
| 3 | + docker: |
| 4 | + - image: circleci/python:2.7-stretch-browsers |
| 5 | +install_dependency: &install_dependency |
| 6 | + name: Installation of build and deployment dependencies. |
| 7 | + command: | |
| 8 | + sudo apt install jq |
| 9 | + sudo pip install awscli --upgrade |
| 10 | + sudo pip install docker-compose |
| 11 | + |
| 12 | +install_deploysuite: &install_deploysuite |
| 13 | + name: Installation of install_deploysuite. |
| 14 | + #Git Clone -change back to v1.3 or latest once counter var is generalized. |
| 15 | + command: | |
| 16 | + git clone --branch master https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript |
| 17 | + cp ./../buildscript/master_deploy.sh . |
| 18 | + cp ./../buildscript/buildenv.sh . |
| 19 | + cp ./../buildscript/awsconfiguration.sh . |
| 20 | + |
| 21 | +restore_cache_settings_for_build: &restore_cache_settings_for_build |
| 22 | + key: docker-tc-email-service-{{ checksum "package-lock.json" }} |
| 23 | + |
| 24 | +save_cache_settings: &save_cache_settings |
| 25 | + key: docker-tc-email-service-{{ checksum "package-lock.json" }} |
| 26 | + paths: |
| 27 | + - node_modules |
| 28 | + |
| 29 | +run_build: &run_build |
| 30 | + name: Build of Docker image |
| 31 | + command: ./build.sh |
| 32 | + |
2 | 33 |
|
3 | 34 | jobs:
|
4 | 35 | # Build & Deploy against development backend rer
|
5 | 36 | "build-dev":
|
6 |
| - docker: |
7 |
| - - image: docker:17.06.1-ce-git |
| 37 | + <<: *defaults |
8 | 38 | steps:
|
9 |
| - # Initialization. |
10 | 39 | - checkout
|
11 | 40 | - setup_remote_docker
|
12 |
| - - run: |
13 |
| - name: Installation of build dependencies. |
14 |
| - command: apk add --no-cache bash |
15 |
| - |
16 |
| - # Restoration of node_modules from cache. |
17 |
| - - restore_cache: |
18 |
| - key: docker-tc-email-service-{{ checksum "package-lock.json" }} |
19 |
| - |
20 |
| - # Build of Docker image. |
21 |
| - - run: |
22 |
| - name: Build of Docker image |
23 |
| - command: ./build.sh DEV |
24 |
| - |
25 |
| - # Caching node modules. |
26 |
| - - save_cache: |
27 |
| - key: docker-tc-email-service-{{ checksum "package-lock.json" }} |
28 |
| - paths: |
29 |
| - - node_modules |
30 |
| - |
31 |
| - # Deployment. |
32 |
| - - run: |
33 |
| - name: Installing AWS client |
34 |
| - command: | |
35 |
| - apk add --no-cache jq py-pip sudo |
36 |
| - sudo pip install awscli --upgrade |
37 |
| -
|
| 41 | + - run: *install_dependency |
| 42 | + - run: *install_deploysuite |
| 43 | + # - restore_cache: *restore_cache_settings_for_build |
| 44 | + - run: *run_build |
| 45 | + # - save_cache: *save_cache_settings |
38 | 46 | - deploy:
|
39 |
| - command: ./deploy.sh DEV $CIRCLE_SHA1 |
40 |
| - |
| 47 | + name: Running Masterscript - deploy tc-email-service |
| 48 | + command: | |
| 49 | + ./awsconfiguration.sh DEV |
| 50 | + source awsenvconf |
| 51 | + ./buildenv.sh -e DEV -b dev-tc-email-service-deployvar |
| 52 | + source buildenvvar |
| 53 | + ./master_deploy.sh -d ECS -e DEV -t latest -s dev-global-appvar,dev-tc-email-service-appvar -i tc-email-service -p FARGATE |
| 54 | + |
| 55 | + |
41 | 56 | "build-prod":
|
42 |
| - docker: |
43 |
| - - image: docker:17.06.1-ce-git |
| 57 | + <<: *defaults |
44 | 58 | steps:
|
45 |
| - # Initialization. |
46 | 59 | - checkout
|
47 | 60 | - setup_remote_docker
|
48 |
| - - run: |
49 |
| - name: Installation of build dependencies. |
50 |
| - command: apk add --no-cache bash |
51 |
| - |
52 |
| - # Restoration of node_modules from cache. |
53 |
| - - restore_cache: |
54 |
| - key: docker-tc-email-service-{{ checksum "package-lock.json" }} |
55 |
| - |
56 |
| - # Build of Docker image. |
57 |
| - - run: |
58 |
| - name: Build of Docker image |
59 |
| - command: ./build.sh PROD |
60 |
| - |
61 |
| - # Caching node modules. |
62 |
| - - save_cache: |
63 |
| - key: docker-tc-email-service-{{ checksum "package-lock.json" }} |
64 |
| - paths: |
65 |
| - - node_modules |
66 |
| - |
67 |
| - # Deployment. |
68 |
| - - run: |
69 |
| - name: Installing AWS client |
70 |
| - command: | |
71 |
| - apk add --no-cache jq py-pip sudo |
72 |
| - sudo pip install awscli --upgrade |
73 |
| -
|
| 61 | + - run: *install_dependency |
| 62 | + - run: *install_deploysuite |
| 63 | + # - restore_cache: *restore_cache_settings_for_build |
| 64 | + - run: *run_build |
| 65 | + # - save_cache: *save_cache_settings |
74 | 66 | - deploy:
|
75 |
| - command: ./deploy.sh PROD $CIRCLE_SHA1 |
| 67 | + name: Running Masterscript - prod deploy tc-email-service |
| 68 | + command: | |
| 69 | + ./awsconfiguration.sh PROD |
| 70 | + source awsenvconf |
| 71 | + ./buildenv.sh -e PROD -b prod-tc-email-service-deployvar |
| 72 | + source buildenvvar |
| 73 | + ./master_deploy.sh -d ECS -e PROD -t latest -s prod-global-appvar,prod-tc-email-service-appvar -i tc-email-service -p FARGATE |
76 | 74 |
|
| 75 | + |
77 | 76 | workflows:
|
78 | 77 | version: 2
|
79 | 78 | build:
|
80 | 79 | jobs:
|
81 |
| - # Development builds are executed on "dev" branch only. |
| 80 | + # Development builds are executed on "develop" branch only. |
82 | 81 | - "build-dev":
|
| 82 | + context : org-global |
83 | 83 | filters:
|
84 | 84 | branches:
|
85 |
| - only: ["dev"] |
86 |
| - # Production builds are executed on "master" branch only. |
| 85 | + only: ['dev'] |
87 | 86 | - "build-prod":
|
| 87 | + context : org-global |
88 | 88 | filters:
|
89 | 89 | branches:
|
90 |
| - only: "master" |
| 90 | + only: master |
0 commit comments