-
Notifications
You must be signed in to change notification settings - Fork 281
/
.drone.yml
204 lines (187 loc) · 6.07 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
---
kind: pipeline
name: "Push"
concurrency:
limit: 2
steps:
- name: "Test & Build"
image: node:12.13.1
commands:
- export REACT_APP_GIT_SHA=$(git rev-parse --short HEAD)
- echo $REACT_APP_GIT_SHA > .tags
- export BUILD_DOMAIN=$(test -e .domains && cat .domains)
- export BUILD_EXPIRE=$(date -d "+1 month" +%s000)
- npm -g install yarn
- yarn install
- yarn lint
- yarn test:ci --collectCoverage=true
- yarn build
# - name: "Stage with mock server"
# image: instrumentisto/rsync-ssh
# environment:
# PRIVATE_KEY:
# from_secret: deploy_key
# commands:
# - echo "$PRIVATE_KEY" | base64 -d > id_rsa
# - chmod 0600 id_rsa
# - cd build/config/
# - echo "window.env={api:{authUrl:'http://api-v2.mock.openware.work/api/v2/barong',tradeUrl:'http://api-v2.mock.openware.work/api/v2/peatio',applogicUrl:'http://api-v2.mock.openware.work/api/v2/applogic',rangerUrl:'ws://ranger.mock.openware.work/api/v2/ranger'}};" > env.js
# - cat env.js
# - cd /drone/src
# - rsync -avzhre "ssh -i id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" build/ [email protected]:/home/mock/builds/${DRONE_COMMIT_SHA:0:7}
# - rsync -avzhre "ssh -i id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" coverage/ [email protected]:/home/mock/builds/${DRONE_COMMIT_SHA:0:7}-coverage
# - echo "http://${DRONE_COMMIT_SHA:0:7}.mock.openware.work"
# - echo "http://${DRONE_COMMIT_SHA:0:7}-coverage.mock.openware.work"
# - name: "Notify staging"
# image: plugins/slack
# settings:
# webhook:
# from_secret: baseapp_slack_webhook
# channel:
# from_secret: baseapp_slack_channel
# template: >
# {{#success build.status}}
# [SUCCESS] (Base Application) Branch {{ build.branch }} by {{ build.author }} staging has succeeded!
#
# Visit http://{{ truncate build.commit 7 }}.mock.openware.work to check it out!
# Coverage report: http://{{ truncate build.commit 7 }}-coverage.mock.openware.work
# {{else}}
# [FAILURE] Branch {{ build.branch }} by {{ build.author }} staging has failed!
# {{/success}}
# Check the build info here: {{ build.link }}
# when:
# status: [success, failure]
trigger:
event:
- push
branch:
exclude:
- master
- "2-*-stable"
---
kind: pipeline
name: "New version"
concurrency:
limit: 2
steps:
- name: "Test"
image: node:12.13.1
commands:
- npm -g install yarn
- yarn install
- yarn lint
- yarn test:ci --collectCoverage=true
- name: "Bump & Tag"
image: quay.io/openware/sdk-citools:2.6.7
environment:
BRANCH_NAME: ${DRONE_BRANCH}
REPO_NAME: ${DRONE_REPO}
GITHUB_API_KEY:
from_secret: kite_bot_key
commands:
- BUNDLE_GEMFILE=/sdk/Gemfile bundle exec rake --rakefile=/sdk/Rakefile ci:prebuild
- name: "Build Docker image"
image: plugins/docker
settings:
username:
from_secret: quay_username
password:
from_secret: quay_password
repo:
from_secret: quay_repo
registry: quay.io
environment:
REACT_APP_SENTRY_KEY:
from_secret: master_sentry_key
REACT_APP_SENTRY_ORGANIZATION:
from_secret: master_sentry_organization
REACT_APP_SENTRY_PROJECT:
from_secret: master_sentry_project
- name: "Redeploy on master.devkube.com"
image: rubykube/microkube:0.2.0
environment:
WEBHOOK_JWT_SECRET:
from_secret: devkube_webhook_secret
DOCKER_REPO:
from_secret: quay_repo
commands:
- export latest_image=$DOCKER_REPO:$(cat .tags)
- cd /home/app
- bundle exec rake payload:send[frontend,$latest_image,http://$DRONE_BRANCH.devkube.com:1337]
when:
branch:
- master
- name: "Push and Notify"
image: quay.io/openware/sdk-citools:2.6.7
environment:
BOT_USERNAME: kite-bot
BOT_NAME: Kite Bot
BOT_EMAIL: [email protected]
BRANCH_NAME: ${DRONE_BRANCH}
SDK_BRANCH: ${DRONE_BRANCH}
REPO_NAME: ${DRONE_REPO}
TELEGRAM_BOT_TOKEN:
from_secret: baseapp_telegram_bot_token
TELEGRAM_CHAT_ID:
from_secret: baseapp_telegram_chat_id
SLACK_TOKEN:
from_secret: baseapp_slack_token
SLACK_CHANNEL:
from_secret: baseapp_slack_channel
GITHUB_API_KEY:
from_secret: kite_bot_key
commands:
- BUNDLE_GEMFILE=/sdk/Gemfile bundle exec rake --rakefile=/sdk/Rakefile ci:postbuild[/drone/src]
when:
branch:
- master
- "2-*-stable"
# http://plugins.drone.io/drone-plugins/drone-slack/
- name: Slack Notify
image: plugins/slack
settings:
webhook:
from_secret: slack_webhook
channel:
from_secret: slack_webhook_channel
template: >
*{{uppercasefirst repo.name}}*
{{#success build.status}}
[SUCCESS] Branch {{ build.branch }} by {{ build.author }}. Good job.
{{else}}
[FAILURE] Branch {{ build.branch }} by {{ build.author }}. Fix me please.
{{/success}}
when:
branch:
- master
- "2-*-stable"
- name: "Update global OpenDAX version"
image: quay.io/openware/goci:0.0.11
environment:
GIT_TOKEN:
from_secret: kite_bot_key
commands:
- /app/goci -component=frontend versions
when:
branch:
- "*-stable"
- name: "Build custom baseapp with assembly line"
image: curlimages/curl
environment:
SERVER: https://ci.openware.work
REPO: openware/assembly-line
BRANCH: master
COMPONENT: baseapp
DRONE_TOKEN:
from_secret: drone_token
commands:
- COMPONENT_VERSION=$(cat .tags)
- "curl -s -XPOST -H \"Authorization: Bearer $DRONE_TOKEN\" -i \"$SERVER/api/repos/$REPO/builds?branch=$BRANCH&ASSEMBLY_COMPONENT_VERSION=$COMPONENT_VERSION&ASSEMBLY_COMPONENT=$COMPONENT\""
trigger:
branch:
- master
- "2-*-stable"
event:
- push
image_pull_secrets:
- dockerconfigjson