-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.drone.yml
136 lines (134 loc) · 3.31 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
---
kind: "pipeline"
name: "lint"
steps:
- name: "lint"
image: "gcr.io/littleman-co/www-littleman-co--build:6529600"
commands:
- /usr/local/bin/robo lint
trigger:
# Execute this process every time a new pull request is opened
event:
- pull_request
---
kind: "pipeline"
name: "unit-test"
steps:
- name: "test"
image: "gcr.io/littleman-co/www-littleman-co--build:6529600"
commands:
- /usr/local/bin/robo test:unit
trigger:
event:
- pull_request
---
kind: "pipeline"
name: "integration-test"
steps:
- name: "test"
image: "gcr.io/littleman-co/www-littleman-co--build:6529600"
commands:
- /usr/local/bin/robo test:integration
trigger:
event:
- pull_request
depends_on:
- lint
- unit-test
---
kind: "pipeline"
name: "smoke-test"
steps:
- name: "test"
image: "gcr.io/littleman-co/www-littleman-co--build:6529600"
commands:
- /usr/local/bin/robo test:smoke
trigger:
event:
- pull_request
depends_on:
- lint
- unit-test
---
kind: "pipeline"
name: "stress-test"
steps:
- name: "test"
image: "gcr.io/littleman-co/www-littleman-co--build:6529600"
commands:
- /usr/local/bin/robo test:stress
trigger:
event:
- pull_request
depends_on:
- lint
- unit-test
---
kind: "pipeline"
name: "container"
steps:
- name: "container"
image: "gcr.io/littleman-co/www-littleman-co--build:6529600"
environment:
GOOGLE_SERVICE_ACCOUNT:
from_secret: GOOGLE_SERVICE_ACCOUNT
# Required to build container
privileged: true
commands:
# Enable img to push to docker registry
- img login -u _json_key -p "$GOOGLE_SERVICE_ACCOUNT" https://gcr.io
- /usr/local/bin/robo application:compile
- /usr/local/bin/robo container:build --container=web
- /usr/local/bin/robo container:push --container=web
trigger:
branch:
- master
event:
- push
---
kind: "pipeline"
name: "production"
steps:
- name: "deploy"
image: "gcr.io/littleman-co/www-littleman-co--build:6529600"
environment:
B64_GOOGLE_SERVICE_ACCOUNT:
from_secret: "B64_GOOGLE_SERVICE_ACCOUNT"
GOOGLE_APPLICATION_CREDENTIALS: "/tmp/.google-service-account.json"
GOOGLE_PROJECT_NAME: "littleman-co"
GOOGLE_PROJECT_REGION: "europe-west1-d"
GOOGLE_GKE_CLUSTER_NAME: "littleman-co"
KUBERNETES_NAMESPACE: "www-littleman-co"
commands:
- "echo $B64_GOOGLE_SERVICE_ACCOUNT | base64 -d > $GOOGLE_APPLICATION_CREDENTIALS"
- "gcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS"
- "gcloud config set project $GOOGLE_PROJECT_NAME"
- "gcloud container clusters get-credentials --zone $GOOGLE_PROJECT_REGION $GOOGLE_GKE_CLUSTER_NAME"
- |
helm upgrade \
--install \
--namespace www-littleman-co \
--wait \
--set="pod.web.image=gcr.io/littleman-co/www-littleman-co--web:$(git rev-parse --short HEAD)" \
www-littleman-co \
deploy/helm
trigger:
branch:
- master
depends_on:
- container
---
kind: "pipeline"
name: "rollback"
steps:
- name: "rollback"
image: "gcr.io/littleman-co/www-littleman-co--build:6529600"
commands:
- /usr/local/bin/robo rollback --environment=production
trigger:
event:
- rollback
target:
- production
branch:
- master