forked from TheHive-Project/Cortex-Analyzers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
217 lines (197 loc) · 5.79 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
---
kind: pipeline
type: docker
name: default
# Build and publish docker images for analyzers
steps:
- name: build analyzers for release
image: thehiveproject/cortex-neurons-builder
settings:
worker_path: analyzers
namespace: cortexneurons
registry_dockerhub: {from_secret: registry_dockerhub}
registry_harbor: {from_secret: registry_harbor}
stable: true
when:
event: [tag]
- name: build analyzers for snapshot
image: thehiveproject/cortex-neurons-builder
settings:
worker_path: analyzers
namespace: cortexneurons
registry_dockerhub: {from_secret: registry_dockerhub}
registry_harbor: {from_secret: registry_harbor}
when:
branch: [develop]
# Build and publish docker images for responders
- name: build responders for release
image: thehiveproject/cortex-neurons-builder
settings:
worker_path: responders
namespace: cortexneurons
registry_dockerhub: {from_secret: registry_dockerhub}
registry_harbor: {from_secret: registry_harbor}
stable: true
when:
event: [tag]
- name: build responders for snapshot
image: thehiveproject/cortex-neurons-builder
settings:
worker_path: responders
namespace: cortexneurons
registry_dockerhub: {from_secret: registry_dockerhub}
registry_harbor: {from_secret: registry_harbor}
when:
branch: [develop]
# Build and publish catalogs for docker images
- name: build stable catalogs
image: thehiveproject/neurons-build-catalogs
when:
event: [tag]
- name: upload catalogs to bintray
image: thehiveproject/drone-bintray
settings:
user: {from_secret: bintray_user}
key: {from_secret: bintray_key}
subject: thehive-project
package: catalogs
version: latest
override: 1
publish: 1
commands:
- |
export PLUGIN_USER
export PLUGIN_KEY
export PLUGIN_SUBJECT
export PLUGIN_PACKAGE
export PLUGIN_VERSION
export PLUGIN_OVERRIDE
export PLUGIN_PUBLISH
upload \
--file analyzers/analyzers.json \
--repo cortexneurons
upload \
--file analyzers/analyzers-stable.json \
--repo cortexneurons
upload \
--file responders/responders.json \
--repo cortexneurons
upload \
--file responders/responders-stable.json \
--repo cortexneurons
when:
event: [tag]
- name: upload catalogs to package server
image: appleboy/drone-scp
settings:
host: {from_secret: package_host}
username: {from_secret: package_user}
key: {from_secret: package_key}
target: {from_secret: catalog_path}
source:
- analyzers/analyzers.json
- analyzers/analyzers-stable.json
- responders/responders.json
- responders/responders-stable.json
strip_components: 1
when:
event: [tag]
- name: build devel catalogs
image: thehiveproject/neurons-build-catalogs
when:
branch: [develop]
- name: upload devel catalogs to bintray
image: thehiveproject/drone-bintray
settings:
user: {from_secret: bintray_user}
key: {from_secret: bintray_key}
subject: thehive-project
package: catalogs
version: latest
override: 1
publish: 1
commands:
- |
export PLUGIN_USER
export PLUGIN_KEY
export PLUGIN_SUBJECT
export PLUGIN_PACKAGE
export PLUGIN_VERSION
export PLUGIN_OVERRIDE
export PLUGIN_PUBLISH
upload \
--file analyzers/analyzers-devel.json \
--repo cortexneurons
upload \
--file responders/responders-devel.json \
--repo cortexneurons
when:
branch: [develop]
- name: upload devel catalogs to package server
image: appleboy/drone-scp
settings:
host: {from_secret: package_host}
username: {from_secret: package_user}
key: {from_secret: package_key}
target: {from_secret: catalog_path}
source:
- analyzers/analyzers-devel.json
- responders/responders-devel.json
strip_components: 1
when:
branch: [develop]
# Build and publish Documentation
- name: Prepare documentation files
image: thehiveproject/doc-builder
settings:
type: Cortex-Neurons
when:
event: [tag]
- name: Publish documentation
image: thehiveproject/mkdocs
settings:
token: {from_secret: github_token}
when:
event: [tag]
- name: rebuild all analyzers periodically
image: thehiveproject/cortex-neurons-builder
settings:
worker_path: analyzers
namespace: cortexneurons
registry_dockerhub: {from_secret: docker_credentials}
registry_harbor: {from_secret: harbor_credentials}
stable: true
force: true
when:
event: [cron]
- name: rebuild all responders periodically
image: thehiveproject/cortex-neurons-builder
settings:
worker_path: responders
namespace: cortexneurons
registry_dockerhub: {from_secret: docker_credentials}
registry_harbor: {from_secret: harbor_credentials}
stable: true
force: true
when:
event: [cron]
- name: send message
image: thehiveproject/drone_keybase
settings:
username: {from_secret: keybase_username}
paperkey: {from_secret: keybase_paperkey}
channel: {from_secret: keybase_channel}
commands:
- |
keybase oneshot -u "$PLUGIN_USERNAME" --paperkey "$PLUGIN_PAPERKEY"
URL="$DRONE_SYSTEM_PROTO://$DRONE_SYSTEM_HOST/$DRONE_REPO/$DRONE_BUILD_NUMBER"
if [ $DRONE_BUILD_STATUS = "success" ]
then
keybase chat send "$PLUGIN_CHANNEL" ":white_check_mark: $DRONE_REPO: build succeeded $URL"
else
keybase chat send "$PLUGIN_CHANNEL" ":x: $DRONE_REPO: build failed $URL"
fi
when:
status:
- success
- failure