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