-
Notifications
You must be signed in to change notification settings - Fork 1
/
.drone.yml
112 lines (102 loc) · 2.75 KB
/
.drone.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
kind: pipeline
type: kubernetes
name: rt-emailer
platform:
os: linux
arch: amd64
steps:
- 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:
from_secret: aws_access_key_id
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: test_and_build
pull: if-not-exists
image: quay.io/ukhomeofficedigital/scala-sbt:latest
commands:
- /root/entrypoint.sh
- sbt test clean assembly
environment:
ARTIFACTORY_PASSWORD:
from_secret: DOCKER_PASSWORD
ARTIFACTORY_USERNAME: regt-build-bot
DB_HOST: "mongodatabase"
when:
event:
- push
- name: build_image
pull: if-not-exists
image: 340268328991.dkr.ecr.eu-west-2.amazonaws.com/acp/dind
environment:
AWS_REGION: eu-west-2
commands:
- docker build -t 340268328991.dkr.ecr.eu-west-2.amazonaws.com/rtge/rt-emailer:$${DRONE_COMMIT_SHA} .
volumes:
- name: dockerclientconfig
path: /root/.docker
depends_on:
- test_and_build
when:
event:
- push
- tag
# https://docs.acp.homeoffice.gov.uk/how-to/security/trivy
- name: vulnerability-scan
pull: Always
image: 340268328991.dkr.ecr.eu-west-2.amazonaws.com/acp/trivy/client:latest
resources:
limits:
cpu: 1000
memory: 1024Mi
environment:
FAIL_ON_DETECTION: false
IMAGE_NAME: 340268328991.dkr.ecr.eu-west-2.amazonaws.com/rtge/rt-emailer:${DRONE_COMMIT_SHA}
SEVERITY: MEDIUM,HIGH,CRITICAL
when:
branch:
- master
event:
- push
depends_on:
- build_image
- name: push_build_image
image: plugins/ecr
settings:
registry: 340268328991.dkr.ecr.eu-west-2.amazonaws.com
repo: rtge/rt-emailer
access_key:
from_secret: AWS_ACCESS_KEY_ID
secret_key:
from_secret: AWS_SECRET_ACCESS_KEY
tags:
- ${DRONE_COMMIT_SHA}
- latest
environment:
AWS_REGION: eu-west-2
when:
event:
- push
depends_on:
- build_image
services:
- name: docker
image: 340268328991.dkr.ecr.eu-west-2.amazonaws.com/acp/dind
- name: mongodatabase
pull: if-not-exists
image: mongo:5.0
volumes:
- name: dockerclientconfig
temp: {}