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