-
Notifications
You must be signed in to change notification settings - Fork 2
/
.drone-v1.yml
189 lines (177 loc) · 4.29 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
---
kind: pipeline
name: default
type: kubernetes
platform:
os: linux
arch: amd64
steps:
- name: Build and test front end
pull: if-not-exists
image: quay.io/ukhomeofficedigital/scala-sbt-nodejs:v1.3.0a
environment:
CI: false
commands:
- cd react
- pwd && npm install
- pwd && npm run build
- pwd && npm run test-ci
when:
event:
- push
- name: Copy front end to resources
pull: if-not-exists
image: quay.io/ukhomeofficedigital/scala-sbt:latest
commands:
- pwd && rm -rf ./src/main/resources/frontend
- pwd && mv ./react/build ./src/main/resources/frontend
when:
event:
- push
depends_on:
- Build and test front end
- name: Unit tests
pull: if-not-exists
image: quay.io/ukhomeofficedigital/scala-sbt:latest
commands:
- /root/entrypoint.sh
- sbt -mem 2048 test
environment:
ARTIFACTORY_PASSWORD:
from_secret: ARTIFACTORY_PASSWORD
ARTIFACTORY_USERNAME: drt_ci
when:
event:
- push
depends_on:
- Copy front end to resources
- name: Build docker image
pull: if-not-exists
image: quay.io/ukhomeofficedigital/scala-sbt:latest
commands:
- /root/entrypoint.sh
- sbt docker:stage
environment:
ARTIFACTORY_PASSWORD:
from_secret: ARTIFACTORY_PASSWORD
ARTIFACTORY_USERNAME: drt_ci
when:
event:
- push
depends_on:
- Unit tests
- name: Publish app
image: plugins/ecr
environment:
AWS_REGION: eu-west-2
settings:
access_key:
from_secret: AWS_ACCESS_KEY_ID
secret_key:
from_secret: AWS_SECRET_ACCESS_KEY
repo: drt/drt-dashboard
registry: 340268328991.dkr.ecr.eu-west-2.amazonaws.com
tags:
- B${DRONE_BUILD_NUMBER}
- latest
when:
event:
- push
depends_on:
- Build docker image
- Copy front end to resources
- name: Code coverage report
pull: if-not-exists
image: quay.io/ukhomeofficedigital/scala-sbt:latest
commands:
- /root/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:
- leader
depends_on:
- Unit tests
- name: Scapegoat
pull: if-not-exists
image: quay.io/ukhomeofficedigital/scala-sbt:latest
commands:
- /root/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:
- leader
depends_on:
- Code coverage report
- name: Dependency check
pull: if-not-exists
image: quay.io/ukhomeofficedigital/scala-sbt:latest
commands:
- /root/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:
- leader
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:
- leader
depends_on:
- Dependency check
- 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"
environment:
SLACK_WEBHOOK:
from_secret: slack_webhook
when:
status:
- success
- failure
event:
- push
depends_on:
- Publish app
- Unit tests
services:
- name: NVD mirror service
image: sspringett/nvdmirror
ports:
- 8008
...