forked from anishkny/realworld-dynamodb-lambda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
103 lines (95 loc) · 2.08 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
variables:
ENV: dev
before_script:
- cd backend/
stages:
- dependencies
- test
- build
- deploy
node_modules:
image: node:14-slim
stage: dependencies
script:
- npm install
- npm run postinstall
cache:
key: node_modules
paths:
- backend/node_modules
- backend/.dynamodb
policy: push
tags:
- general
lint&test:
image: node:14-slim
stage: test
needs: [ "node_modules" ]
script:
- npm run test
cache:
key: node_modules
paths:
- backend/node_modules
- backend/.dynamodb
policy: pull
tags:
- general
build:
image: node:14-slim
stage: build
script:
- npm run deploy
cache:
key: node_modules
paths:
- backend/node_modules
policy: pull
tags:
- general
test_deploy:
image: node:14-slim
stage: build
needs: ["build"]
script:
- apt update -y && apt-get install curl unzip groff jq -y
- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install
- rm -rf aws*
- ./api_info.sh
- npm run test:deployed
cache:
- key: node_modules
paths:
- backend/node_modules
policy: pull
tags:
- general
plan_tf:
image:
name: hashicorp/terraform:light
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
stage: deploy
script:
- cd security
- rm -rf .terraform*
- terraform init --backend-config=backend-$ENV.conf
- terraform plan
tags:
- general
apply_tf:
image:
name: hashicorp/terraform:light
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
stage: deploy
needs: ["plan_tf"]
script:
- cd security
- rm -rf .terraform*
- terraform init --backend-config=backend-$ENV.conf
- terraform apply -auto-approve
tags:
- general