Skip to content

Commit f47de61

Browse files
committed
Merge branch 'release/3.1.0-RC1'
2 parents 643b72a + 904fce9 commit f47de61

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1595
-1810
lines changed

.drone.yml

+78-132
Original file line numberDiff line numberDiff line change
@@ -1,196 +1,142 @@
11
---
22
kind: pipeline
33
name: default
4-
5-
# Disable default clone
6-
clone:
7-
disable: true
4+
type: docker
85

96
steps:
10-
# This clone step doesn't use "root" user
11-
- name: clone
12-
image: plugins/git:next
13-
147
# Restore cache of downloaded dependencies
15-
- name: restore cache
8+
- name: restore-cache
169
image: drillster/drone-volume-cache
1710
settings:
1811
restore: true
1912
mount:
2013
- .sbt
2114
- .ivy2
22-
- www/node_modules
15+
- ui/node_modules
16+
- ui/bower_components
2317
volumes: [{name: cache, path: /cache}]
2418

2519
# Run project tests
26-
- name: run tests and build stage
20+
- name: run-tests
2721
image: thehiveproject/drone-scala-node
2822
commands:
29-
- . ~/.nvm/nvm.sh
30-
- sbt -Duser.home=$PWD test stage
23+
- sbt -Duser.home=$PWD test:compile test
3124

3225
# Build packages
33-
- name: build packages
26+
- name: build-packages
3427
image: thehiveproject/drone-scala-node
3528
settings:
3629
pgp_key: {from_secret: pgp_key}
3730
commands:
3831
- |
32+
V=$(sbt -no-colors --error "print cortex/version" | tail -1)
33+
if ( echo $V | grep -qi snapshot)
34+
then
35+
exit 1
36+
fi
3937
. ~/.nvm/nvm.sh
4038
[ -n "$PLUGIN_PGP_KEY" ] && gpg --batch --import - <<< $PLUGIN_PGP_KEY
4139
sbt -Duser.home=$PWD docker:stage debian:packageBin rpm:packageBin universal:packageBin
40+
if ( echo $V | grep -qi rc )
41+
then
42+
echo $( echo $V | sed -re 's/([0-9]+.[0-9]+.[0-9]+)-RC([0-9]+)-([0-9]+)/\1-RC\2,\1-RC\2-\3/' ) > .tags
43+
else
44+
echo $( echo $V | sed -re 's/([0-9]+).([0-9]+).([0-9]+)-([0-9]+)/\1,\1.\2,\1.\2.\3,\1.\2.\3-\4,latest/' ) > .tags
45+
fi
46+
echo $V > cortex-version.txt
47+
mv target/rpm/RPMS/noarch/cortex*.rpm target/
48+
mv target/universal/cortex*.zip target/
4249
when:
4350
event: [tag]
4451

4552
# Save external libraries in cache
46-
- name: save cache
53+
- name: save-cache
4754
image: drillster/drone-volume-cache
4855
settings:
4956
rebuild: true
57+
backend: "filesystem"
5058
mount:
5159
- .sbt
5260
- .ivy2
53-
- www/node_modules
61+
- .cache
62+
- ui/node_modules
63+
- ui/bower_components
5464
volumes: [{name: cache, path: /cache}]
5565

66+
# Send packages using scp
67+
- name: send packages
68+
image: appleboy/drone-scp
69+
settings:
70+
host: {from_secret: package_host}
71+
username: {from_secret: package_user}
72+
key: {from_secret: package_key}
73+
target: {from_secret: incoming_path}
74+
source:
75+
- target/cortex*.deb
76+
- target/cortex*.rpm
77+
- target/cortex*.zip
78+
strip_components: 1
79+
when:
80+
event: [tag]
81+
82+
# Publish packages
5683
- name: publish packages
57-
image: thehiveproject/drone-bintray
84+
image: appleboy/drone-ssh
5885
settings:
59-
user: {from_secret: bintray_user}
60-
key: {from_secret: bintray_key}
61-
subject: thehive-project
62-
package: cortex
86+
host: {from_secret: package_host}
87+
user: {from_secret: package_user}
88+
key: {from_secret: package_key}
89+
publish_script: {from_secret: publish_script}
6390
commands:
64-
- |
65-
export PLUGIN_USER
66-
export PLUGIN_KEY
67-
export PLUGIN_SUBJECT
68-
export PLUGIN_PACKAGE
69-
export PLUGIN_VERSION=$(cut -d\" -f2 version.sbt)
70-
echo "Publishing package version $PLUGIN_VERSION"
71-
72-
if echo $PLUGIN_VERSION | grep -qvi -E \
73-
-e '^[0-9]+\.[0-9]+\.[0-9]+$' \
74-
-e '^[0-9]+\.[0-9]+\.[0-9]+-[0-9]+$' \
75-
-e '^[0-9]+\.[0-9]+\.[0-9]+-RC[0-9]+$'; then
76-
echo The version $PLUGIN_VERSION has invalid format
77-
exit 1
78-
fi
79-
80-
CHANNEL=stable
81-
if $(echo $PLUGIN_VERSION | grep -qi rc)
82-
then
83-
CHANNEL=beta
84-
V=$(echo $PLUGIN_VERSION | sed -e 's/-\([rR][cC]\)/-0.1\1/')
85-
DEB_FILE=target/cortex_$${V}_all.deb
86-
RPM_FILE=target/rpm/RPMS/noarch/cortex-$${V}.noarch.rpm
87-
else
88-
DEB_FILE=target/cortex_$${PLUGIN_VERSION}_all.deb
89-
RPM_FILE=target/rpm/RPMS/noarch/cortex-$${PLUGIN_VERSION}.noarch.rpm
90-
fi
91-
ZIP_FILE=target/universal/cortex-$${PLUGIN_VERSION}.zip
92-
93-
upload \
94-
--file $DEB_FILE \
95-
--repo debian-beta \
96-
--extra-param deb_distribution=any \
97-
--extra-param deb_component=main \
98-
--extra-param deb_architecture=all
99-
100-
[ $CHANNEL = stable ] && upload \
101-
--file $DEB_FILE \
102-
--repo debian-stable \
103-
--extra-param deb_distribution=any \
104-
--extra-param deb_component=main \
105-
--extra-param deb_architecture=all
106-
107-
upload \
108-
--file $RPM_FILE \
109-
--repo rpm-beta
110-
111-
[ $CHANNEL = stable ] && upload \
112-
--file $RPM_FILE \
113-
--repo rpm-stable
114-
115-
upload \
116-
--file $ZIP_FILE \
117-
--repo binary
118-
119-
LATEST_VERSION=latest
120-
[ $CHANNEL = beta ] && LATEST_VERSION=latest-beta
121-
122-
removeVersion \
123-
--repo binary \
124-
--version $LATEST_VERSION
125-
126-
upload \
127-
--file $ZIP_FILE \
128-
--repo binary \
129-
--version $LATEST_VERSION \
130-
--dest-file cortex-$${LATEST_VERSION}.zip
91+
- PLUGIN_SCRIPT="bash $PLUGIN_PUBLISH_SCRIPT cortex $(cat cortex-version.txt)" /bin/drone-ssh
13192
when:
13293
event: [tag]
13394

134-
# Publish docker image
95+
# Publish docker image on Docker Hub
13596
- name: docker
13697
image: plugins/docker
13798
settings:
13899
context: target/docker/stage
139100
dockerfile: target/docker/stage/Dockerfile
140101
repo: thehiveproject/cortex
141-
auto_tag: true
142102
username: {from_secret: docker_username}
143103
password: {from_secret: docker_password}
144104
when:
145105
event: [tag]
146106

147-
# Deploy binaries in integration environment
148-
- name: copy binaries in integration environment
149-
image: appleboy/drone-scp
150-
settings:
151-
host: {from_secret: deploy_beta_host}
152-
username: {from_secret: deploy_username}
153-
key: {from_secret: deploy_key}
154-
target: ./cortex-builds/${DRONE_BUILD_NUMBER}
155-
source: target/universal/stage
156-
strip_components: 3
157-
when:
158-
branch: [develop]
159-
160-
- name: deploy binaries in integration environment
161-
image: appleboy/drone-ssh
162-
settings:
163-
host: {from_secret: deploy_beta_host}
164-
username: {from_secret: deploy_username}
165-
key: {from_secret: deploy_key}
166-
script:
167-
- ./start cortex ${DRONE_BUILD_NUMBER}
168-
when:
169-
branch: [develop]
170-
171-
# Deploy binaries in staging environment
172-
- name: copy binaries in staging environment
173-
image: appleboy/drone-scp
107+
# Publish docker image on Harbor
108+
- name: harbor
109+
image: plugins/docker
174110
settings:
175-
host: {from_secret: deploy_stable_host}
176-
username: {from_secret: deploy_username}
177-
key: {from_secret: deploy_key}
178-
target: ./cortex-builds/${DRONE_BUILD_NUMBER}
179-
source: target/universal/stage
180-
strip_components: 3
111+
context: target/docker/stage
112+
dockerfile: target/docker/stage/Dockerfile
113+
registry: {from_secret: harbor_registry}
114+
repo: {from_secret: harbor_repo}
115+
username: {from_secret: harbor_username}
116+
password: {from_secret: harbor_password}
181117
when:
182-
branch: [master]
118+
event: [tag]
183119

184-
- name: deploy binaries in staging environment
185-
image: appleboy/drone-ssh
120+
- name: send message
121+
image: thehiveproject/drone_keybase
186122
settings:
187-
host: {from_secret: deploy_stable_host}
188-
username: {from_secret: deploy_username}
189-
key: {from_secret: deploy_key}
190-
script:
191-
- ./start cortex ${DRONE_BUILD_NUMBER}
123+
username: {from_secret: keybase_username}
124+
paperkey: {from_secret: keybase_paperkey}
125+
channel: {from_secret: keybase_channel}
126+
commands:
127+
- |
128+
keybase oneshot -u "$PLUGIN_USERNAME" --paperkey "$PLUGIN_PAPERKEY"
129+
URL="$DRONE_SYSTEM_PROTO://$DRONE_SYSTEM_HOST/$DRONE_REPO/$DRONE_BUILD_NUMBER"
130+
if [ $DRONE_BUILD_STATUS = "success" ]
131+
then
132+
keybase chat send "$PLUGIN_CHANNEL" ":white_check_mark: $DRONE_REPO: build succeeded $URL"
133+
else
134+
keybase chat send "$PLUGIN_CHANNEL" ":x: $DRONE_REPO: build failed $URL"
135+
fi
192136
when:
193-
branch: [master]
137+
status:
138+
- success
139+
- failure
194140

195141
volumes:
196142
- name: cache

.scalafmt.conf

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
version = "2.0.0-RC7"
1+
version = 2.3.2
2+
project.git = true
23
align = more # For pretty alignment.
34
assumeStandardLibraryStripMargin = true
45
style = defaultWithAlign
56
maxColumn = 150
67

78
align.openParenCallSite = false
89
align.openParenDefnSite = false
9-
newlines.alwaysBeforeTopLevelStatements = true
10+
newlines.alwaysBeforeTopLevelStatements = false
1011
rewrite.rules = [
11-
# ExpandImportSelectors
1212
RedundantBraces
1313
RedundantParens
1414
SortModifiers
@@ -20,7 +20,7 @@ includeCurlyBraceInSelectChains = true
2020
includeNoParensInSelectChains = true
2121

2222
rewriteTokens {
23-
"=>" : ""
24-
"<-" : ""
25-
"->": ""
23+
"" : "=>"
24+
"" : "<-"
25+
"→" : "->"
2626
}

0 commit comments

Comments
 (0)