forked from OpenCTI-Platform/opencti
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.drone.yml
285 lines (277 loc) · 11.3 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
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
284
285
---
kind: pipeline
name: opencti-tests
steps:
- name: api-tests
image: nikolaik/python-nodejs:python3.11-nodejs20-alpine
volumes:
- name: cache-node-backend
path: /drone/src/opencti-platform/opencti-graphql/node_modules
- name: cache-python
path: /usr/lib/python3.11
environment:
APP__BASE_URL: http://api-tests:4010/
APP__ADMIN__PASSWORD: admin
APP__SYNC_RAW_START_REMOTE_URI: http://opencti-raw-start:4100/graphql
APP__SYNC_LIVE_START_REMOTE_URI: http://opencti-live-start:4200/graphql
APP__SYNC_DIRECT_START_REMOTE_URI: http://opencti-direct-start:4300/graphql
APP__SYNC_RESTORE_START_REMOTE_URI: http://opencti-restore-start:4400/graphql
APP__ADMIN__TOKEN: bfa014e0-e02e-4aa6-a42b-603b19dcf159
REDIS__HOSTNAME: redis
ELASTICSEARCH__URL: http://elastic:9200
MINIO__ENDPOINT: minio
RABBITMQ__HOSTNAME: rabbitmq
EXPIRATION_SCHEDULER__ENABLED: false
SUBSCRIPTION_SCHEDULER__ENABLED: false
SMTP__HOSTNAME: smtp.ethereal.email
SMTP__PORT: 587
SMTP__USERNAME: [email protected]
SMTP__PASSWORD: frhJ2mSPTfaEutpbug
PYTHONUNBUFFERED: 1
commands:
- apk add build-base git libffi-dev cargo
- pip3 install --upgrade setuptools
- BRANCH=$(echo $DRONE_COMMIT_BRANCH | cut -d "/" -f 2)
- CLIENT_PYTHON_BRANCH=$([[ "$(echo "$(git ls-remote --heads https://github.com/OpenCTI-Platform/client-python.git opencti/$BRANCH)")" != '' ]] && echo opencti/$BRANCH || echo 'master')
- CONNECTOR_BRANCH=$([[ $(git ls-remote --heads https://github.com/OpenCTI-Platform/connectors.git opencti/$BRANCH) ]] && echo opencti/$BRANCH || echo 'master')
- git clone -b $CONNECTOR_BRANCH https://github.com/OpenCTI-Platform/connectors.git opencti-connectors
- cd opencti-platform/opencti-graphql
- yarn install
- yarn build
- yarn check-ts
- yarn lint
- pip3 install --upgrade --force git+https://github.com/OpenCTI-Platform/client-python@$CLIENT_PYTHON_BRANCH
- NODE_OPTIONS=--max_old_space_size=8192 yarn test
- name: api-coverage
image: plugins/codecov
settings:
token: e5c6fb05-76f7-4985-86cf-ff843d5d103e
paths:
- opencti-platform/opencti-graphql/coverage
- name: frontend-tests
image: node:20-alpine
volumes:
- name: cache-node-frontend
path: /drone/src/opencti-platform/opencti-front/node_modules
- name: cache-python
path: /usr/lib/python3.11
commands:
- apk add git tini gcc g++ make musl-dev cargo python3 python3-dev postfix postfix-pcre
- npm install -g node-gyp
- cd opencti-platform/opencti-front
- yarn install
- yarn build
- yarn check-ts
- yarn lint
- NODE_OPTIONS=--max_old_space_size=8192 yarn test
- name: build-circleci
image: curlimages/curl
commands:
- curl -X POST --data "branch=master" https://circleci.com/api/v1.1/project/github/OpenCTI-Platform/opencti/build?circle-token=$CIRCLECI_TOKEN
environment:
CIRCLECI_TOKEN:
from_secret: circleci_token
when:
branch:
- master
event:
exclude:
- pull_request
- tag
- name: build-circleci-release
image: curlimages/curl
commands:
- curl -X POST --data "tag=$DRONE_TAG" https://circleci.com/api/v1.1/project/github/OpenCTI-Platform/opencti/build?circle-token=$CIRCLECI_TOKEN
environment:
CIRCLECI_TOKEN:
from_secret: circleci_token
when:
event:
- tag
- name: slack
image: plugins/slack
settings:
webhook:
from_secret: slack_webhook
username: drone
channel: notifications
when:
status: [success, failure]
services:
- name: redis
image: redis:7.2.3
- name: elastic
image: docker.elastic.co/elasticsearch/elasticsearch:8.11.3
environment:
discovery.type: single-node
xpack.security.enabled: false
ES_JAVA_OPTS: -Xms2g -Xmx2g
- name: minio
image: minio/minio:RELEASE.2023-07-07T07-13-57Z
environment:
MINIO_ROOT_USER: ChangeMe
MINIO_ROOT_PASSWORD: ChangeMe
command: [server, /data]
- name: rabbitmq
image: rabbitmq:3.12-management
- name: opencti-raw-start
image: nikolaik/python-nodejs:python3.11-nodejs20-alpine
volumes:
- name: cache-node-raw-start-backend
path: /tmp/raw-start-platform/opencti-graphql/node_modules
- name: cache-python
path: /usr/lib/python3.11
environment:
APP__PORT: 4100
APP__ADMIN__PASSWORD: admin
APP__ADMIN__TOKEN: bfa014e0-e02e-4aa6-a42b-603b19dcf159
REDIS__HOSTNAME: redis
REDIS__NAMESPACE: raw-start
ELASTICSEARCH__URL: http://elastic:9200
ELASTICSEARCH__INDEX_PREFIX: raw-start
MINIO__ENDPOINT: minio
MINIO__BUCKET_NAME: raw-start-bucket
RABBITMQ__HOSTNAME: rabbitmq
EXPIRATION_SCHEDULER__ENABLED: false
SUBSCRIPTION_SCHEDULER__ENABLED: false
commands:
- cp -a opencti-platform/* /tmp/raw-start-platform/
- apk add build-base git libffi-dev cargo
- cd /tmp/raw-start-platform/opencti-graphql
- yarn install
- yarn install:python
- BRANCH=$(echo $DRONE_COMMIT_BRANCH | cut -d "/" -f 2)
- CLIENT_PYTHON_BRANCH=$([[ "$(echo "$(git ls-remote --heads https://github.com/OpenCTI-Platform/client-python.git opencti/$BRANCH)")" != '' ]] && echo opencti/$BRANCH || echo 'master')
- pip3 install --upgrade --force git+https://github.com/OpenCTI-Platform/client-python@$CLIENT_PYTHON_BRANCH
- NODE_OPTIONS=--max_old_space_size=8192 yarn start
- name: opencti-live-start
image: nikolaik/python-nodejs:python3.11-nodejs20-alpine
volumes:
- name: cache-node-live-start-backend
path: /tmp/live-start-platform/opencti-graphql/node_modules
- name: cache-python
path: /usr/lib/python3.11
environment:
APP__PORT: 4200
APP__ADMIN__PASSWORD: admin
APP__ADMIN__TOKEN: bfa014e0-e02e-4aa6-a42b-603b19dcf159
REDIS__HOSTNAME: redis
REDIS__NAMESPACE: live-start
ELASTICSEARCH__URL: http://elastic:9200
ELASTICSEARCH__INDEX_PREFIX: live-start
MINIO__ENDPOINT: minio
MINIO__BUCKET_NAME: live-start-bucket
RABBITMQ__HOSTNAME: rabbitmq
EXPIRATION_SCHEDULER__ENABLED: false
SUBSCRIPTION_SCHEDULER__ENABLED: false
commands:
- cp -a opencti-platform/* /tmp/live-start-platform/
- apk add build-base git libffi-dev cargo
- cd /tmp/live-start-platform/opencti-graphql
- yarn install
- yarn install:python
- BRANCH=$(echo $DRONE_COMMIT_BRANCH | cut -d "/" -f 2)
- CLIENT_PYTHON_BRANCH=$([[ "$(echo "$(git ls-remote --heads https://github.com/OpenCTI-Platform/client-python.git opencti/$BRANCH)")" != '' ]] && echo opencti/$BRANCH || echo 'master')
- pip3 install --upgrade --force git+https://github.com/OpenCTI-Platform/client-python@$CLIENT_PYTHON_BRANCH
- NODE_OPTIONS=--max_old_space_size=8192 yarn start
- name: opencti-direct-start
image: nikolaik/python-nodejs:python3.11-nodejs20-alpine
volumes:
- name: cache-node-direct-start-backend
path: //tmp/direct-start-platform/opencti-graphql/node_modules
- name: cache-python
path: /usr/lib/python3.11
environment:
APP__PORT: 4300
APP__ADMIN__PASSWORD: admin
APP__ADMIN__TOKEN: bfa014e0-e02e-4aa6-a42b-603b19dcf159
REDIS__HOSTNAME: redis
REDIS__NAMESPACE: direct-start
ELASTICSEARCH__URL: http://elastic:9200
ELASTICSEARCH__INDEX_PREFIX: direct-start
MINIO__ENDPOINT: minio
MINIO__BUCKET_NAME: direct-start-bucket
RABBITMQ__HOSTNAME: rabbitmq
EXPIRATION_SCHEDULER__ENABLED: false
SUBSCRIPTION_SCHEDULER__ENABLED: false
commands:
- cp -a opencti-platform/* /tmp/direct-start-platform/
- apk add build-base git libffi-dev cargo
- cd /tmp/direct-start-platform/opencti-graphql
- yarn install
- yarn install:python
- BRANCH=$(echo $DRONE_COMMIT_BRANCH | cut -d "/" -f 2)
- CLIENT_PYTHON_BRANCH=$([[ "$(echo "$(git ls-remote --heads https://github.com/OpenCTI-Platform/client-python.git opencti/$BRANCH)")" != '' ]] && echo opencti/$BRANCH || echo 'master')
- pip3 install --upgrade --force git+https://github.com/OpenCTI-Platform/client-python@$CLIENT_PYTHON_BRANCH
- NODE_OPTIONS=--max_old_space_size=8192 yarn start
- name: opencti-direct-worker
image: nikolaik/python-nodejs:python3.11-nodejs20-alpine
volumes:
- name: cache-python
path: /usr/lib/python3.11
environment:
OPENCTI_URL: http://opencti-direct-start:4300
OPENCTI_TOKEN: bfa014e0-e02e-4aa6-a42b-603b19dcf159
WORKER_LOG_LEVEL: info
commands:
- cp -a opencti-worker /tmp/direct-start-worker
- apk add build-base git libffi-dev cargo
- while ! nc -z opencti-direct-start 4300 ; do sleep 1 ; done
- cd /tmp/direct-start-worker
- pip3 install -r src/requirements.txt
- BRANCH=$(echo $DRONE_COMMIT_BRANCH | cut -d "/" -f 2)
- CLIENT_PYTHON_BRANCH=$([[ "$(echo "$(git ls-remote --heads https://github.com/OpenCTI-Platform/client-python.git opencti/$BRANCH)")" != '' ]] && echo opencti/$BRANCH || echo 'master')
- pip3 install --upgrade --force git+https://github.com/OpenCTI-Platform/client-python@$CLIENT_PYTHON_BRANCH
- python3 src/worker.py
- name: opencti-restore-start
image: nikolaik/python-nodejs:python3.11-nodejs20-alpine
volumes:
- name: cache-node-raw-start-backend
path: /tmp/restore-start-platform/node_modules
- name: cache-python
path: /usr/lib/python3.11
environment:
APP__PORT: 4400
APP__ADMIN__PASSWORD: admin
APP__ADMIN__TOKEN: bfa014e0-e02e-4aa6-a42b-603b19dcf159
REDIS__HOSTNAME: redis
REDIS__NAMESPACE: restore-start
ELASTICSEARCH__URL: http://elastic:9200
ELASTICSEARCH__INDEX_PREFIX: restore-start
MINIO__ENDPOINT: minio
MINIO__BUCKET_NAME: restore-start-bucket
RABBITMQ__HOSTNAME: rabbitmq
EXPIRATION_SCHEDULER__ENABLED: false
SUBSCRIPTION_SCHEDULER__ENABLED: false
commands:
- cp -a opencti-platform/* /tmp/restore-start-platform/
- apk add build-base git libffi-dev cargo
- cd /tmp/restore-start-platform/opencti-graphql
- yarn install
- yarn install:python
- BRANCH=$(echo $DRONE_COMMIT_BRANCH | cut -d "/" -f 2)
- CLIENT_PYTHON_BRANCH=$([[ "$(echo "$(git ls-remote --heads https://github.com/OpenCTI-Platform/client-python.git opencti/$BRANCH)")" != '' ]] && echo opencti/$BRANCH || echo 'master')
- pip3 install --upgrade --force git+https://github.com/OpenCTI-Platform/client-python@$CLIENT_PYTHON_BRANCH
- NODE_OPTIONS=--max_old_space_size=8192 yarn start
volumes:
- name: cache-node-backend
host:
path: /tmp/cache-node-backend
- name: cache-node-raw-start-backend
host:
path: /tmp/cache-node-raw-start-backend
- name: cache-node-live-start-backend
host:
path: /tmp/cache-node-live-start-backend
- name: cache-node-direct-start-backend
host:
path: /tmp/cache-node-direct-start-backend
- name: cache-node-restore-start-backend
host:
path: /tmp/cache-node-restore-start-backend
- name: cache-node-frontend
host:
path: /tmp/cache-node-frontend
- name: cache-python
host:
path: /tmp/cache-python