-
Notifications
You must be signed in to change notification settings - Fork 8
/
.drone-v1.yml
229 lines (214 loc) · 6.38 KB
/
.drone-v1.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
---
kind: pipeline
name: DRT-V2
type: kubernetes
platform:
os: linux
arch: amd64
steps:
- name: Build app
pull: if-not-exists
image: quay.io/ukhomeofficedigital/scala-sbt-nodejs:v1.3.0a
commands:
- /app/entrypoint.sh
- node --version
- sbt --error compile docker:stage
environment:
ARTIFACTORY_PASSWORD:
from_secret: ARTIFACTORY_PASSWORD
ARTIFACTORY_USERNAME: drt_ci
ENV_LOG_LEVEL: ERROR
KEYTOOL_PASSWORD:
from_secret: KEYTOOL_PASSWORD
when:
event:
- push
- name: ECR login
pull: if-not-exists
image: quay.io/ukhomeofficedigital/dind-awscli:19.03.12-dind-1.18.55
environment:
AWS_ACCESS_KEY_ID: AKIAU6OMSVAPQAIHYUVJ
AWS_SECRET_ACCESS_KEY:
from_secret: aws_secret_access_key
commands:
# wait for docker service to be up before running docker build
- n=0; while [ "$n" -lt 60 ] && [ ! docker stats --no-stream ]; do n=$(( n + 1 )); sleep 1; done
- aws ecr get-login-password --region eu-west-2 | docker login --username AWS --password-stdin 340268328991.dkr.ecr.eu-west-2.amazonaws.com
volumes:
- name: dockerclientconfig
path: /root/.docker
when:
event:
- push
- name: Publish cypress
image: plugins/ecr
environment:
AWS_REGION: eu-west-2
settings:
access_key: AKIAU6OMSVAPQAIHYUVJ
secret_key:
from_secret: aws_secret_access_key
repo: drt/drt-v2
registry: 340268328991.dkr.ecr.eu-west-2.amazonaws.com
dockerfile: cy-drt-dockfile
tags:
- cypress-${DRONE_BUILD_NUMBER}
when:
event:
- push
depends_on:
- ECR login
- name: Unit tests
pull: if-not-exists
image: quay.io/ukhomeofficedigital/scala-sbt-nodejs:v1.3.0a
commands:
- /app/entrypoint.sh
- sbt -mem 4096 --error test
environment:
ARTIFACTORY_PASSWORD:
from_secret: ARTIFACTORY_PASSWORD
ARTIFACTORY_USERNAME: drt_ci
ENV_LOG_LEVEL: ERROR
when:
event:
- push
depends_on:
- Build app
- name: Code coverage report
pull: if-not-exists
image: quay.io/ukhomeofficedigital/scala-sbt-nodejs:v1.3.0a
commands:
- /app/entrypoint.sh
- sbt -mem 4096 --error coverage test | true
- sbt coverageReport
environment:
ARTIFACTORY_PASSWORD:
from_secret: ARTIFACTORY_PASSWORD
ARTIFACTORY_USERNAME: drt_ci
ENV_LOG_LEVEL: ERROR
when:
event:
- push
branch:
- master
depends_on:
- Unit tests
- name: Scapegoat
pull: if-not-exists
image: quay.io/ukhomeofficedigital/scala-sbt-nodejs:v1.3.0a
commands:
- /app/entrypoint.sh
- sbt scapegoat | true
environment:
NVD_BASE_URL: http://nvdmirror:8008
ARTIFACTORY_PASSWORD:
from_secret: ARTIFACTORY_PASSWORD
ARTIFACTORY_USERNAME: drt_ci
ENV_LOG_LEVEL: ERROR
when:
event:
- push
branch:
- master
depends_on:
- Code coverage report
- name: Dependency check
pull: if-not-exists
image: quay.io/ukhomeofficedigital/scala-sbt-nodejs:v1.3.0a
commands:
- /app/entrypoint.sh
- sbt -mem 4096 dependencyCheck
environment:
NVD_BASE_URL: http://nvdmirror:8008
ARTIFACTORY_PASSWORD:
from_secret: ARTIFACTORY_PASSWORD
ARTIFACTORY_USERNAME: drt_ci
ENV_LOG_LEVEL: ERROR
when:
event:
- push
branch:
- master
depends_on:
- Scapegoat
- name: Sonar scanner
pull: if-not-exists
image: quay.io/ukhomeofficedigital/sonar-scanner:v4.6
commands:
- sonar-scanner -Dsonar.projectVersion=B${DRONE_BUILD_NUMBER} -X
environment:
DRONE_BUILD_NUMBER: ${DRONE_BUILD_NUMBER}
when:
event:
- push
branch:
- master
depends_on:
- Dependency check
- name: Publish app
image: plugins/ecr
environment:
AWS_REGION: eu-west-2
settings:
access_key: AKIAU6OMSVAPQAIHYUVJ
secret_key:
from_secret: aws_secret_access_key
repo: drt/drt-v2
registry: 340268328991.dkr.ecr.eu-west-2.amazonaws.com
tags:
- B${DRONE_BUILD_NUMBER}
when:
event:
- push
depends_on:
- Build app
- name: End to end test
pull: if-not-exists
image: 340268328991.dkr.ecr.eu-west-2.amazonaws.com/acp/dind
environment:
AWS_REGION: eu-west-2
PLAY:
from_secret: play
PLAY_HTTP_SECRET_KEY:
from_secret: PLAY_HTTP_SECRET_KEY
commands:
- docker run -m 5g -d --name $${DRONE_COMMIT_SHA} -e S3_AWS_ACCESS_KEY_ID="some-aws-access-id" -e S3_AWS_SECRET_ACCESS_KEY="some-aws-secret-access-id" -e PLAY_HTTP_SECRET_KEY=$${PLAY_HTTP_SECRET_KEY} -e ENABLE_STATSD=false -e CONTACT_EMAIL=support@test.com -e OOH_PHONE=012345 -e KEY_CLOAK_URL="https://sso-dev.notprod.homeoffice.gov.uk/auth/admin/realms/drt-notprod" -e JAVA_OPTS="-Xmx4g -Dconfig.resource=application-inmemory.conf" -e USE_API_PAX_NOS=true -e ADJUST_EGATES_USE_BY_U12S=true -e PORT_CODE="test" -e ENV="test" -e FORECAST_MAX_DAYS=2 -e DISPLAY_RED_LIST_INFO=false -e BASE_DOMAIN=drt-test.homeoffice.gov.uk -e START_UP_GRACE_PERIOD_SECONDS=0 340268328991.dkr.ecr.eu-west-2.amazonaws.com/drt/drt-v2:B${DRONE_BUILD_NUMBER} $${PLAY}
- docker run --net=container:$${DRONE_COMMIT_SHA} -e CYPRESS_baseUrl="http://localhost:9000" 340268328991.dkr.ecr.eu-west-2.amazonaws.com/drt/drt-v2:cypress-${DRONE_BUILD_NUMBER} /bin/bash -c "/app/node_modules/.bin/cypress run"
volumes:
- name: dockerclientconfig
path: /root/.docker
when:
event:
- push
depends_on:
- Publish app
- name: Slack notification
pull: if-not-exists
image: plugins/slack
settings:
channel: devs
template: "*{{repo.name}}: _{{build.status}}_*\nCompleted build *{{build.number}}* after *{{since build.started}}* on *{{build.branch}}*\n{{build.link}}\n"
username: drone
environment:
SLACK_WEBHOOK:
from_secret: slack_webhook
when:
status:
- success
- failure
event:
- push
depends_on:
- Unit tests
- End to end test
services:
- name: Docker in Docker
image: 340268328991.dkr.ecr.eu-west-2.amazonaws.com/acp/dind
- name: NVD mirror service
image: sspringett/nvdmirror
ports:
- 8008
volumes:
- name: dockerclientconfig
temp: { }
...