forked from codefresh-io/demochat
-
Notifications
You must be signed in to change notification settings - Fork 2
/
pip.yaml
283 lines (274 loc) · 8.81 KB
/
pip.yaml
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
version: '1.0'
stages:
- build
- publish
- deploy
steps:
main_clone:
stage: build
type: git-clone
title: Cloning Git Repo
git: CF-default
repo: ${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}
revision: ${{CF_REVISION}}
build_image_sdk:
stage: build
type: build
title: Docker build & pack sdk image
dockerfile: Dockerfile
description: Building code...
working_directory: ${{main_clone}}
image_name: broadvoice/messaging.api
tag: 'sdk-${{CF_SHORT_REVISION}}'
metadata:
set:
- git_repo: '${{CF_REPO_NAME}}'
- git_branch: '${{CF_BRANCH}}'
- git_link: '${{CF_COMMIT_URL}}'
- git_author: '${{CF_COMMIT_AUTHOR}}'
- git_commit_message: '${{CF_COMMIT_MESSAGE}}'
- tag: 'sdk-${{CF_SHORT_REVISION}}'
build_arguments:
- BRANCH=${{CF_BRANCH}}
- COMMIT=${{CF_REVISION}}
- ASPNETCORE_ENVIRONMENT=${{ASPNETCORE_ENVIRONMENT}}
when:
branch:
only:
- master
- develop
- /^feature\/.*/i
- /^bug\/.*/i
- /^release\/.*/i
- /^hotfix\/.*/i
#ignore: [ 'feature/BC-1667' ]
compose_test:
stage: build
type: composition
title: Use Docker Compose to run XUnit Tests
working_directory: ./test
description: Running tests...
when:
condition:
all:
releaseMatch: 'match("${{CF_BRANCH}}", "^(develop$|feature|bug|release|hotfix)", true) == true'
notSkipTest: 'match("${{CF_COMMIT_MESSAGE}}", "skip\b*([x]?unit\b*|)test", true) == false'
notMultiTest: 'match("${{CF_BRANCH}}", "BC-1667", true) == false'
composition:
version: '3'
services:
# cassandra 1
scylla-node-1:
image: "broadvoice/scyllacluster:latest"
ports:
- 7000
- 10000
- 9160
- 9042
volumes:
- ${{CF_VOLUME}}:/codefresh/volume
environment:
- PROJECTNAME=${{CF_REPO_NAME}}
- MEMORY=512M
logging:
driver: none
# cassandra 2
scylla-node-2:
image: "broadvoice/scyllacluster:latest"
ports:
- 7000
- 10000
- 9160
- 9042
links:
- scylla-node-1
depends_on:
- scylla-node-1
environment:
- PRIMARY_NODE=scylla-node-1
- MEMORY=512M
logging:
driver: none
# elastic search 1
es:
image: broadvoice/ci-elasticsearch:latest
user: elasticsearch
ports:
- 9200
- 9300
environment:
- 'discovery.type=single-node'
- 'xpack.security.enabled=false'
- 'ES_JAVA_OPTS=-Xms300m -Xmx300m'
- 'CEREBRO_VER='
logging:
driver: none
# redis 1
redis:
image: redis:4-alpine
ports:
- 6379
logging:
driver: none
# rmq 1
rmq-1:
image: 'broadvoice/ci-messaging-rmq:latest'
ports:
- 5672
- 15672
logging:
driver: none
# asp.net code
api:
image: ${{build_image_sdk}}
environment:
- 'ASPNETCORE_URLS=http://*:80'
- 'APPLICATION_NAME=Broadvoice.Messaging.API'
working_dir: /src
entrypoint: ./codefresh-integration-test-entry.sh
ports:
- 80
depends_on:
- scylla-node-1
- scylla-node-2
- es
- redis
- rmq-1
links:
- scylla-node-1
- scylla-node-2
- es
- redis
- rmq-1
volumes:
${{CF_VOLUME}}:
external: true
composition_candidates:
api:
image: ${{build_image_sdk}}
environment:
- 'TESTCONSOLE=Off'
- 'ELASTICSEARCH__CONNECTIONSTRING=Hosts=es:9200'
- 'CASSANDRASETTINGS__CONNECTIONSTRING=Contact Points=scylla-node-1,scylla-node-2;Port=9042;UseStreamMode=true;KeepAlive=true;MaxSchemaAgreementWaitSeconds=100000;ReuseAddress=true;ConnectTimeoutMillis=180000;QueryTimeoutMillis=180000;ReadTimeoutMillis=180000'
- 'REDISCONNECTIONFACTORY__CONNECTIONSTRING=redis:6379,syncTimeout=2500,connectTimeout=8000,configCheckSeconds=15'
- 'RABBITMQCONNECTION__CONNECTIONSTRING=amqp://guest:guest@rmq-1:5672/'
- 'CONST__PROXYURL=${{CONST_BASEURL}}'
copy_sdk_artifacts:
stage: build
title: Share Sdk Artifacts
description: Copy artifacts from build sdk step
image: ${{build_image_sdk}}
working_directory: ${{main_clone}}
when:
branch:
only:
- develop
- /^feature\/.*/i
- /^bug\/.*/i
- /^release\/.*/i
- /^hotfix\/.*/i
commands:
- mkdir -p /codefresh/volume/broadvoice.messaging/publish
- echo 'Publish content:'
- cp -r /Broadvoice/Messaging.API/publish/* /codefresh/volume/broadvoice.messaging/publish
- ls /codefresh/volume/broadvoice.messaging/publish
- echo 'Copied publish files!!!'
build_runtime_image:
stage: build
type: build
title: Docker build & pack runtime image
dockerfile: Dockerfile.Runtime.Dockerfile
description: Building Runtime Image
working_directory: ${{main_clone}}
image_name: broadvoice/messaging.api
tag: 'runtime-${{CF_SHORT_REVISION}}'
metadata:
set:
- git_repo: '${{CF_REPO_NAME}}'
- git_branch: '${{CF_BRANCH}}'
- git_link: '${{CF_COMMIT_URL}}'
- git_author: '${{CF_COMMIT_AUTHOR}}'
- git_commit_message: '${{CF_COMMIT_MESSAGE}}'
- tag: 'runtime-${{CF_SHORT_REVISION}}'
build_arguments:
- BRANCH=${{CF_BRANCH}}
- COMMIT=${{CF_REVISION}}
- ASPNETCORE_ENVIRONMENT=${{ASPNETCORE_ENVIRONMENT}}
when:
branch:
only:
- develop
- /^feature\/.*/i
- /^bug\/.*/i
- /^release\/.*/i
- /^hotfix\/.*/i
push_develop_img_dockerhub:
stage: publish
type: push
title: 'Publish Integration Image to DockerHub'
candidate: '${{build_runtime_image}}'
image_name: broadvoice/messaging.api
tags:
- develop
- integration
registry: dockerhub
when:
condition:
any:
developBranch: '"${{CF_BRANCH}}" == "develop"'
fakeDevBranch: 'match("${{CF_BRANCH}}", "feature/BC-1667", true) == true'
push_rc_img_dockerhub:
stage: publish
type: push
title: 'Publish RC/QA Image to Dockerhub'
candidate: '${{build_runtime_image}}'
image_name: broadvoice/messaging.api
tags:
- rc-${{CF_SHORT_REVISION}}
- qa
registry: dockerhub
when:
condition:
any:
releaseMatch: 'match("${{CF_BRANCH}}", "^release\/.*", true) == true'
hotfixMatch: 'match("${{CF_BRANCH}}", "^hotfix\/.*", true) == true'
deploy_proxmox_dev:
stage: deploy
title: Deploy to Dev Environment (ProxMox)
image: node:latest
working_directory: ${{main_clone}}
environment:
- DOCKER_TAG=${{DOCKER_TAG}}
- CONST_BASEURL=${{CONST_BASEURL}}
- CONST_BASECLIENTURL=${{CONST_BASECLIENTURL}}
commands:
- echo " IdentityFile ~/.ssh/id_rsa" >> /etc/ssh/ssh_config
- mkdir -p ~/.ssh; echo ${{SSH_KEY}} | base64 --decode > ~/.ssh/id_rsa; chmod 600 ~/.ssh/id_rsa
- sed -i '2iDOCKER_TAG=${{DOCKER_TAG}}' deploy_proxmox.sh
#- cat deploy_proxmox.sh
#- echo '==========================='
- REMOTECOMMAND=$(base64 -w0 deploy_proxmox.sh); ssh -o StrictHostKeyChecking=no -p 23895 [email protected] "echo $REMOTECOMMAND | base64 -d | sudo bash"
when:
condition:
any:
developBranch: '"${{CF_BRANCH}}" == "develop"'
fakeDevBranch: 'match("${{CF_BRANCH}}", "feature/BC-1667", true) == true'
deploy_proxmox_qa:
stage: deploy
title: Deploy to QA Environment (ProxMox)
image: node:latest
working_directory: ${{main_clone}}
environment:
- DOCKER_TAG=${{DOCKER_TAG}}
- CONST_BASEURL=${{CONST_BASEURL}}
- CONST_BASECLIENTURL=${{CONST_BASECLIENTURL}}
commands:
- echo " IdentityFile ~/.ssh/id_rsa" >> /etc/ssh/ssh_config
- mkdir -p ~/.ssh; echo ${{SSH_KEY}} | base64 --decode > ~/.ssh/id_rsa; chmod 600 ~/.ssh/id_rsa
- sed -i '2iDOCKER_TAG=${{DOCKER_TAG}}' deploy_proxmox.sh
- REMOTECOMMAND=$(base64 -w0 deploy_proxmox.sh); ssh -o StrictHostKeyChecking=no -p 23896 [email protected] "echo $REMOTECOMMAND | base64 -d | sudo bash"
when:
condition:
any:
releaseMatch: 'match("${{CF_BRANCH}}", "^release\/.*", true) == true'
hotfixMatch: 'match("${{CF_BRANCH}}", "^hotfix\/.*", true) == true'