-
Notifications
You must be signed in to change notification settings - Fork 4
/
.drone.yml
128 lines (114 loc) · 3.46 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
---
global-variables:
acp-docker-image: &acp-docker-image 340268328991.dkr.ecr.eu-west-2.amazonaws.com/acp/dind:latest
trivy-image: &trivy-image quay.io/ukhomeofficedigital/trivyscanner:master
kind: pipeline
name: default
type: kubernetes
platform:
os: linux
arch: amd64
environment:
TERRAFORM_VERSION_MAJOR: 1
TERRAFORM_VERSION_MINOR: 6
TERRAFORM_VERSION_PATCH: 6
steps:
- name: build_docker_image
pull: if-not-exists
image: *acp-docker-image
commands:
- /usr/local/bin/wait
- docker build --build-arg TERRAFORM_VERSION=$${TERRAFORM_VERSION_MAJOR}.$${TERRAFORM_VERSION_MINOR}.$${TERRAFORM_VERSION_PATCH} --tag tf-testrunner:b-$${DRONE_BUILD_NUMBER} .
when:
event:
- push
- name: push_image_to_quay
pull: if-not-exists
image: *acp-docker-image
commands:
- docker login --username=$${DOCKER_USERNAME} --password=$${DOCKER_PASSWORD} quay.io
- docker tag tf-testrunner:b-$${DRONE_BUILD_NUMBER} quay.io/ukhomeofficedigital/tf-testrunner:b-$${DRONE_BUILD_NUMBER}
- docker push quay.io/ukhomeofficedigital/tf-testrunner:b-$${DRONE_BUILD_NUMBER}
environment:
DOCKER_USERNAME:
from_secret: DOCKER_USERNAME
DOCKER_PASSWORD:
from_secret: DOCKER_PASSWORD
when:
branch:
exclude:
- master
event:
- push
- name: trivy_scan
pull: if-not-exists
image: *trivy-image
commands:
- trivy image --ignore-unfixed --exit-code 0 --no-progress quay.io/ukhomeofficedigital/tf-testrunner:b-${DRONE_BUILD_NUMBER}
when:
branch:
exclude:
- master
event:
- push
- name: test_example_implementation
image: quay.io/ukhomeofficedigital/tf-testrunner:b-${DRONE_BUILD_NUMBER}
commands:
- cd examples/basic_proof
- python -m unittest tests/*_test.py
when:
branch:
exclude:
- master
event:
- push
- name: push_master_image_to_quay
pull: if-not-exists
image: *acp-docker-image
commands:
- docker login --username=$${DOCKER_USERNAME} --password=$${DOCKER_PASSWORD} quay.io
- docker tag tf-testrunner:b-$${DRONE_BUILD_NUMBER} quay.io/ukhomeofficedigital/tf-testrunner:b-$${DRONE_BUILD_NUMBER}
- docker push quay.io/ukhomeofficedigital/tf-testrunner:b-$${DRONE_BUILD_NUMBER}
environment:
DOCKER_USERNAME:
from_secret: DOCKER_USERNAME
DOCKER_PASSWORD:
from_secret: DOCKER_PASSWORD
when:
branch:
- master
event:
- push
- name: trivy_scan_master
pull: if-not-exists
image: *trivy-image
commands:
- trivy image --ignore-unfixed --exit-code 0 --no-progress quay.io/ukhomeofficedigital/tf-testrunner:b-${DRONE_BUILD_NUMBER}
when:
branch:
- master
event:
- push
- name: promote_master
pull: if-not-exists
image: *acp-docker-image
commands:
- docker login --username=$${DOCKER_USERNAME} --password=$${DOCKER_PASSWORD} quay.io
- docker pull quay.io/ukhomeofficedigital/tf-testrunner:b-$${DRONE_BUILD_PARENT}
- docker tag quay.io/ukhomeofficedigital/tf-testrunner:b-$${DRONE_BUILD_PARENT} quay.io/ukhomeofficedigital/tf-testrunner:TF$${TERRAFORM_VERSION_MAJOR}.$${TERRAFORM_VERSION_MINOR}
- docker push quay.io/ukhomeofficedigital/tf-testrunner:TF$${TERRAFORM_VERSION_MAJOR}.$${TERRAFORM_VERSION_MINOR}
environment:
DOCKER_PASSWORD:
from_secret: DOCKER_PASSWORD
DOCKER_USERNAME:
from_secret: DOCKER_USERNAME
when:
branch:
- master
event:
- promote
target:
- production
services:
- name: docker
image: *acp-docker-image