forked from OpenCTI-Platform/opencti
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
238 lines (231 loc) · 9.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
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
---
kind: pipeline
name: opencti-tests
steps:
- name: api-tests
image: node:18-alpine
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 python3 python3-dev
- ln -sf python3 /usr/bin/python
- python3 -m ensurepip
- pip3 install --no-cache --upgrade pip 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 --no-cache-dir git+https://github.com/OpenCTI-Platform/client-python@$CLIENT_PYTHON_BRANCH
- sleep 60
- 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:16-alpine
commands:
- 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
icon_url: https://avatars.githubusercontent.com/oa/1284929
channel: notifications
when:
status: [success, failure]
event:
exclude:
- pull_request
services:
- name: redis
image: redis:7.0.11
- name: elastic
image: docker.elastic.co/elasticsearch/elasticsearch:8.8.0
environment:
discovery.type: single-node
xpack.security.enabled: false
ES_JAVA_OPTS: -Xms2g -Xmx2g
- name: minio
image: minio/minio:RELEASE.2023-06-02T23-17-26Z
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.10-nodejs18-alpine
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:
- sleep 30
- apk add build-base git libffi-dev
- cp -a opencti-platform /tmp/raw-start-platform
- 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 --no-cache-dir 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.10-nodejs18-alpine
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:
- sleep 90
- apk add build-base git libffi-dev python3-dev
- cp -a opencti-platform /tmp/live-start-platform
- 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 --no-cache-dir 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.10-nodejs18-alpine
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:
- sleep 60
- apk add build-base git libffi-dev python3-dev
- cp -a opencti-platform /tmp/direct-start-platform
- 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 --no-cache-dir 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.10-nodejs18-alpine
environment:
OPENCTI_URL: http://opencti-direct-start:4300
OPENCTI_TOKEN: bfa014e0-e02e-4aa6-a42b-603b19dcf159
WORKER_LOG_LEVEL: info
commands:
- sleep 180
- apk add build-base git libffi-dev
- cp -a opencti-worker /tmp/direct-start-worker
- 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 --no-cache-dir git+https://github.com/OpenCTI-Platform/client-python@$CLIENT_PYTHON_BRANCH
- python3 src/worker.py
- name: opencti-restore-start
image: nikolaik/python-nodejs:python3.10-nodejs18-alpine
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:
- sleep 120
- apk add build-base git libffi-dev python3-dev
- cp -a opencti-platform /tmp/restore-start-platform
- 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 --no-cache-dir git+https://github.com/OpenCTI-Platform/client-python@$CLIENT_PYTHON_BRANCH
- NODE_OPTIONS=--max_old_space_size=8192 yarn start