forked from chrisns/packer-encrypt-copy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.drone.yml
110 lines (99 loc) · 2.99 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
---
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
steps:
- name: build_docker_image
pull: if-not-exists
image: *acp-docker-image
commands:
- /usr/local/bin/wait
- docker build --tag dq-packer-encrypt-copy: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 dq-packer-encrypt-copy:b-$${DRONE_BUILD_NUMBER} quay.io/ukhomeofficedigital/dq-packer-encrypt-copy:b-$${DRONE_BUILD_NUMBER}
- docker push quay.io/ukhomeofficedigital/dq-packer-encrypt-copy: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/dq-packer-encrypt-copy:b-${DRONE_BUILD_NUMBER}
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 dq-packer-encrypt-copy:b-$${DRONE_BUILD_NUMBER} quay.io/ukhomeofficedigital/dq-packer-encrypt-copy:b-$${DRONE_BUILD_NUMBER}
- docker push quay.io/ukhomeofficedigital/dq-packer-encrypt-copy: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/dq-packer-encrypt-copy: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/dq-packer-encrypt-copy:b-$${DRONE_BUILD_PARENT}
- docker tag quay.io/ukhomeofficedigital/dq-packer-encrypt-copy:b-$${DRONE_BUILD_PARENT} quay.io/ukhomeofficedigital/dq-packer-encrypt-copy:latest
- docker push quay.io/ukhomeofficedigital/dq-packer-encrypt-copy:latest
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