-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
128 lines (115 loc) · 2.74 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
stages:
- test
- build
- upload
- deploy
image: clojure:openjdk-11-lein
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- /root/.m2
- /root/.lein
variables:
BUILD_IMAGE: clojure:lein-2.8.1-alpine
GIT_STRATEGY: none
DATABASE_URL: "mysql://mysql/sonnen-db?user=sonnen&password=sonnen&allowPublicKeyRetrieval=true&useSSL=false"
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: sonnen-db
MYSQL_USER: sonnen
MYSQL_PASSWORD: sonnen
test:
stage: test
image: $BUILD_IMAGE
variables:
GIT_STRATEGY: fetch
before_script:
- lein deps
script:
- lein run migrate
- bin/kaocha --plugin cloverage
services:
- mysql:5.7
build:uberjar:
stage: build
image: $BUILD_IMAGE
variables:
GIT_STRATEGY: fetch
script:
- lein uberjar
- mv target/uberjar/battery-measurements-api.jar $CI_PROJECT_DIR
artifacts:
name: "battery-measurements-api-${CI_BUILD_REF_NAME}-${CI_BUILD_ID}"
paths:
- battery-measurements-api.jar
only:
- develop
- master
staging:upload-s3:
stage: upload
image: $CI_REGISTRY/digital-dev/docker/awscli:latest
dependencies:
- build:uberjar
variables:
AWS_ACCESS_KEY_ID: $AWS_STAGING_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_STAGING_SECRET
S3_BUCKET_NAME: battery-measurements-api-deployments-staging
cache: {}
environment:
name: staging
url: http://116.203.80.78:8080
script:
- aws s3 cp battery-measurements-api.jar s3://${S3_BUCKET_NAME}/${CI_COMMIT_SHORT_SHA}/
only:
- develop
staging:nomad-deploy:
stage: deploy
image: $CI_REGISTRY/digital-dev/docker/deploy:latest
cache: {}
environment:
name: staging
variables:
GIT_STRATEGY: fetch
script: bin/nomad-deploy.sh
only:
- develop
production:upload-s3:
stage: upload
image: $CI_REGISTRY/digital-dev/docker/awscli:latest
dependencies:
- build:uberjar
variables:
AWS_ACCESS_KEY_ID: $AWS_PRODUCTION_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_PRODUCTION_SECRET
S3_BUCKET_NAME: battery-measurements-api-deployments-production
cache: {}
environment:
name: production
url: http://116.203.80.78:8081
script:
- aws s3 cp battery-measurements-api.jar s3://${S3_BUCKET_NAME}/${CI_COMMIT_SHORT_SHA}/
only:
- master
production:nomad-deploy:
stage: deploy
image: $CI_REGISTRY/digital-dev/docker/deploy:latest
cache: {}
environment:
name: production
url: http://116.203.80.78:8081
variables:
GIT_STRATEGY: fetch
script: bin/nomad-deploy.sh
only:
- master
production:deploy-monitoring:
stage: deploy
image: $CI_REGISTRY/digital-dev/docker/deploy:latest
cache: {}
environment:
name: production
url: http://116.203.80.78:8080
variables:
GIT_STRATEGY: fetch
script: bin/deploy-monitoring.sh
only:
- master