|
1 | 1 | version: 2.1 |
2 | | -parameters: |
3 | | - aws-profile: |
4 | | - type: string |
5 | | - default: default |
6 | | - aws-region: |
7 | | - type: string |
8 | | - default: us-east-2 |
9 | | - cluster-name: |
10 | | - type: string |
11 | | - default: operationcode-backend |
12 | 2 |
|
13 | 3 | orbs: |
14 | 4 | docker: circleci/docker@0.5.1 |
@@ -37,66 +27,50 @@ workflows: |
37 | 27 | only: |
38 | 28 | - main |
39 | 29 |
|
| 30 | + # Deploy the new docker image to the AWS EKS cluster, staging namespace |
| 31 | + - aws-eks/update-container-image: |
| 32 | + container-image-updates: 'app=operationcode/resources-api:${CIRCLE_BUILD_NUM}' |
| 33 | + cluster-name: 'operationcode-backend' |
| 34 | + namespace: 'operationcode-staging' |
| 35 | + resource-name: 'deployment/resources-api' |
| 36 | + get-rollout-status: true |
| 37 | + watch-rollout-status: true |
| 38 | + watch-timeout: 5m |
| 39 | + record: true |
| 40 | + requires: |
| 41 | + - docker/publish |
| 42 | + filters: |
| 43 | + branches: |
| 44 | + only: |
| 45 | + - main |
| 46 | + |
40 | 47 | jobs: |
41 | 48 | build_test: |
42 | | - |
43 | 49 | machine: |
44 | 50 | image: ubuntu-1604:201903-01 |
45 | | - |
46 | 51 | environment: |
47 | 52 | CC_TEST_REPORTER_ID: 08bad9e4f229f88064fd6ee1c0fe4f64be37943beff36f37f8b8896123ef6752 |
48 | 53 |
|
49 | 54 | steps: |
50 | | - |
51 | 55 | - checkout |
52 | | - |
53 | 56 | - run: sudo chown -R circleci:circleci /usr/local/bin |
54 | | - |
55 | 57 | - run: |
56 | 58 | name: Initializing CodeClimate |
57 | 59 | command: | |
58 | 60 | curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /usr/local/bin/cc-test-reporter |
59 | 61 | chmod +x /usr/local/bin/cc-test-reporter |
60 | 62 | /usr/local/bin/cc-test-reporter before-build |
61 | | -
|
62 | 63 | - run: |
63 | 64 | name: Run tests |
64 | 65 | command: | |
65 | 66 | make test |
66 | | -
|
67 | | -
|
68 | 67 | - run: |
69 | 68 | name: Run linting and coverage |
70 | 69 | command: | |
71 | 70 | make lint |
72 | 71 | docker-compose run resources-api coverage xml |
73 | 72 | /usr/local/bin/cc-test-reporter after-build |
74 | | -
|
75 | 73 | - run: |
76 | 74 | name: Run Bandit security analysis |
77 | 75 | command: | |
78 | 76 | make bandit |
79 | | -
|
80 | | - staging_deploy: |
81 | | - executor: python3 |
82 | | - parameters: |
83 | | - cluster-name: |
84 | | - description: | |
85 | | - Operation Code Backend Cluster |
86 | | - type: string |
87 | | - steps: |
88 | | - - update-kubeconfig-with-authenticator: |
89 | | - aws-profile: << parameters.aws-profile >> |
90 | | - aws-region: << parameters.aws-region >> |
91 | | - cluster-name: << parameters.cluster-name >> |
92 | | - install-kubectl: true |
93 | | - - aws-eks/update-container-image: |
94 | | - container-image-updates: 'resources-api=resources-api:${CIRCLE_BUILD_NUM}' |
95 | | - namespace: 'operationcode-staging' |
96 | | - record: true |
97 | | - requires: |
98 | | - - docker/publish |
99 | | - filters: |
100 | | - branches: |
101 | | - only: |
102 | | - - main |
0 commit comments