forked from openware/baseapp
-
Notifications
You must be signed in to change notification settings - Fork 16
/
.drone.yml
161 lines (146 loc) · 4.71 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
---
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=$(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/ mock@mock.openware.work:/home/mock/builds/${DRONE_COMMIT_SHA:0:7}
# - rsync -avzhre "ssh -i id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" coverage/ mock@mock.openware.work:/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.4.5
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:
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
username:
from_secret: quay_username
password:
from_secret: quay_password
repo:
from_secret: quay_repo
registry: quay.io
- 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.4.5
environment:
BOT_USERNAME: kite-bot
BOT_NAME: Kite Bot
BOT_EMAIL: kite-bot@heliostech.fr
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"
trigger:
branch:
- master
- "2-*-stable"
event:
- push
image_pull_secrets:
- dockerconfigjson