forked from UKHomeOffice/hocs-info-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
156 lines (143 loc) · 4.94 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
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
pipeline:
wait-for-keycloak:
image: quay.io/ukhomeofficedigital/hocs-docker-tools:build-4
commands:
- |
until $(curl --output /dev/null --silent --head --fail http://keycloak:8080/auth/realms/master/.well-known/openid-configuration); do
echo "waiting for keycloak"
sleep 5
done
- |
export TKN=$(curl -X POST 'http://keycloak:8080/auth/realms/master/protocol/openid-connect/token' -H "Content-Type: application/x-www-form-urlencoded" -d "username=admin" -d 'password=password1' -d 'grant_type=password' -d 'client_id=admin-cli' | jq -r '.access_token')
- |
curl -vX POST http://keycloak:8080/auth/admin/realms -d @keycloak/local-realm.json --header "Authorization: Bearer $TKN" --header "Content-Type: application/json"
build-project:
image: quay.io/ukhomeofficedigital/openjdk11
commands:
- export SPRING_PROFILES_ACTIVE='development, local, test'
- export DB_HOST='postgres'
- export KEYCLOAK_SERVER_ROOT=http://keycloak:8080
- export AWS_LOCAL_HOST='localstack'
- ./gradlew build --no-daemon
when:
event: [push, pull_request, tag]
sonar-scanner:
image: quay.io/ukhomeofficedigital/sonar-scanner:v3.0.2
when:
event: [push, pull_request, tag]
docker-build:
image: docker:17.09.1
environment:
- DOCKER_HOST=tcp://172.17.0.1:2375
commands:
- docker build -t hocs-info-service .
when:
branch: [master, refs/tags/*]
event: [push, tag]
install-docker-image:
image: docker:17.09.1
environment:
- DOCKER_HOST=tcp://172.17.0.1:2375
secrets:
- docker_password
commands:
- docker login -u="ukhomeofficedigital+hocs" -p=$${DOCKER_PASSWORD} quay.io
- docker tag hocs-info-service quay.io/ukhomeofficedigital/hocs-info-service:build-$${DRONE_BUILD_NUMBER}
- docker tag hocs-info-service quay.io/ukhomeofficedigital/hocs-info-service:latest
- docker push quay.io/ukhomeofficedigital/hocs-info-service:build-$${DRONE_BUILD_NUMBER}
- docker push quay.io/ukhomeofficedigital/hocs-info-service:latest
when:
branch: master
event: push
docker-semver-tag:
image: quay.io/ukhomeofficedigital/hocs-version-bot:build-25
environment:
- DOCKER_HOST=tcp://172.17.0.1:2375
- DOCKER_API_VERSION=1.37
secrets:
- github_password
- docker_password
- git_password
commands:
- /app/hocs-deploy --version=$${SEMVER} --serviceGitToken=$${GIT_PASSWORD} --service=hocs-info-service --gitToken=$${GITHUB_PASSWORD} --gitRepo="https://gitlab.digital.homeoffice.gov.uk/hocs/hocs-versions.git" --environment=qa --dockerRepository=quay.io/ukhomeofficedigital --sourceBuild=$${IMAGE_VERSION} --registryUser=ukhomeofficedigital+hocs --registryPassword=$${DOCKER_PASSWORD}
when:
event: deployment
environment: qa
clone-kube-project:
image: plugins/git
commands:
- git clone https://github.com/UKHomeOffice/kube-hocs-info-service.git
when:
event: [push, tag, deployment]
deploy-to-dev-from-build-number:
image: quay.io/ukhomeofficedigital/kd:v1.12.2
environment:
- KUBE_NAMESPACE=cs-dev
- ENVIRONMENT=dev
- VERSION=build-${DRONE_BUILD_NUMBER}
- KUBE_SERVER=https://kube-api-notprod.notprod.acp.homeoffice.gov.uk
secrets:
- hocs_info_service_dev
commands:
- cd kube-hocs-info-service
- ./deploy.sh
when:
branch: master
event: [push, tag]
deployment:
image: quay.io/ukhomeofficedigital/kd:v1.12.2
environment:
- KUBE_NAMESPACE=cs-${DRONE_DEPLOY_TO}
- ENVIRONMENT=${DRONE_DEPLOY_TO}
- KUBE_SERVER=https://kube-api-notprod.notprod.acp.homeoffice.gov.uk
secrets:
- hocs_info_service_dev
- hocs_info_service_demo
commands:
- cd kube-hocs-info-service
- ./deploy.sh
when:
event: deployment
environment: [dev, demo]
deploy-to-qa:
image: quay.io/ukhomeofficedigital/kd:v1.12.2
environment:
- KUBE_NAMESPACE=cs-qa
- ENVIRONMENT=qa
- KUBE_SERVER=https://kube-api-notprod.notprod.acp.homeoffice.gov.uk
secrets:
- hocs_info_service_qa
commands:
- source version.txt
- echo $VERSION
- cd kube-hocs-info-service
- ./deploy.sh
when:
event: deployment
environment: qa
deploy-to-prod:
image: quay.io/ukhomeofficedigital/kd:v1.12.2
environment:
- KUBE_NAMESPACE=cs-prod
- ENVIRONMENT=prod
- KUBE_SERVER=https://kube-api-prod.prod.acp.homeoffice.gov.uk
secrets:
- hocs_info_service_prod
commands:
- cd kube-hocs-info-service
- ./deploy.sh
when:
event: deployment
environment: prod
services:
keycloak:
image: jboss/keycloak
environment:
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: password1
DB_VENDOR: h2
postgres:
image: quay.io/ukhomeofficedigital/postgres-alpine
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: dev