forked from readr-media/election-boards
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
115 lines (109 loc) · 3.76 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
workspace:
base: /python
path: github.com/election-boards
pipeline:
start_slack:
image: plugins/slack
channel: jenkins
secrets: [slack_webhook]
username: election-boards
icon_url: https://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/Python-logo-notext.svg/240px-Python-logo-notext.svg.png
template: >
*start* building *{{repo.name}}*.
*{{build.author}}* give *{{build.branch}}* a little push.
when:
event: [push]
branch: [master, dev]
get_dev_config:
image: gcr.io/mirrormedia-1470651750304/drone-cloud-sdk:latest
secrets: [google_credentials]
commands:
- gcloud source repos clone configs configs
- cp configs/readr-media/election-boards/dev/dev.py ./election_boards/settings/production.py
- cp configs/readr-media/election-boards/secrets.py ./election_boards/settings/secrets.py
- cp configs/gcskeyfile.json ./app/gcskeyfile.json
- rm -rf configs
when:
event: [push]
branch: dev
get_production_config:
image: gcr.io/mirrormedia-1470651750304/drone-cloud-sdk:latest
secrets: [google_credentials]
commands:
- gcloud source repos clone configs configs
- cp configs/readr-media/election-boards/production/production.py ./election_boards/settings/production.py
- cp configs/readr-media/election-boards/secrets.py ./election_boards/settings/secrets.py
- cp configs/readr-media/election-boards/production/uwsgi.ini ./uwsgi.ini
- cp configs/readr-media/election-boards/production/.kube.yml ./.kube.yml
- cp configs/gcskeyfile.json ./app/gcskeyfile.json
- rm -rf configs
when:
event: [push]
branch: master
builds:
image: plugins/gcr
repo: mirrormedia-1470651750304/${DRONE_REPO_NAME}
tag: ${DRONE_COMMIT_AUTHOR}_${DRONE_COMMIT_BRANCH}_${DRONE_BUILD_NUMBER}
environment:
- DOCKER_LAUNCH_DEBUG=true
secrets: [google_credentials]
when:
event: [push]
branch: [master, dev]
deploy:
image: nytimes/drone-gke:develop
zone: asia-east1-a
cluster: dev
namespace: default
# For debugging
dry_run: false
verbose: true
secrets:
- source: google_credentials
target: token
vars:
image: gcr.io/mirrormedia-1470651750304/${DRONE_REPO_NAME}:${DRONE_COMMIT_AUTHOR}_${DRONE_COMMIT_BRANCH}_${DRONE_BUILD_NUMBER}
app: election-boards
tier: backend
serviceName: election-boards
deployName: election-boards
when:
event: [push]
branch: dev
deploy_prod:
image: nytimes/drone-gke:develop
zone: asia-east1-a
cluster: prod-readr
namespace: default
# For debugging
dry_run: false
verbose: true
secrets:
- source: google_credentials
target: token
vars:
image: gcr.io/mirrormedia-1470651750304/${DRONE_REPO_NAME}:${DRONE_COMMIT_AUTHOR}_${DRONE_COMMIT_BRANCH}_${DRONE_BUILD_NUMBER}
app: election-boards
tier: backend
serviceName: election-boards
deployName: election-boards
when:
event: [push]
branch: master
finish_slack:
image: plugins/slack
channel: jenkins
secrets: [slack_webhook]
username: electin-boards
icon_url: https://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/Python-logo-notext.svg/240px-Python-logo-notext.svg.png
when:
status: [success, failure]
event: [push]
branch: [master, dev]
template: >
{{#success build.status}}
Build<${DRONE_BUILD_LINK}|#{{build.number}}> *success* ${DRONE_REPO_NAME}:${DRONE_COMMIT_AUTHOR}_${DRONE_COMMIT_BRANCH}_${DRONE_BUILD_NUMBER} was well served.
Check on our <https://www.readr.tw|site>
{{else}}
Houston, we have a problem. Build <${DRONE_BUILD_LINK}|#{{build.number}}> failed. Fix me please, {{build.author}}
{{/success}}