2121# 3. Compile the source package & run server & toolchain
2222# 4. Run server & toolchain in binary package
2323
24- URL_PREFIX=" https://dist.apache.org/repos/dist/dev/incubator/hugegraph/"
24+ # if we don't want to exit after '|', remove "-o pipefail"
25+ set -euxo pipefail
26+
2527# release version (input by committer)
26- RELEASE_VERSION=$1
27- JAVA_VERSION=$2
28+ RELEASE_VERSION=$1 # like 1.2.0
29+ JAVA_VERSION=$2 # like 11
2830USER=$3
31+
32+ # this URL is only valid during the release process
33+ SVN_URL_PREFIX=" https://dist.apache.org/repos/dist/dev/incubator/hugegraph"
34+
2935# git release branch (check it carefully)
3036# GIT_BRANCH="release-${RELEASE_VERSION}"
3137
32- RELEASE_VERSION=${RELEASE_VERSION:? " Please input the release version behind script" }
38+ RELEASE_VERSION=${RELEASE_VERSION:? " Please input the release version, like 1.2.0" }
39+ USER=${USER:- " imbajin" }
3340WORK_DIR=$(
34- cd " $( dirname " $0 " ) " || exit
41+ cd " $( dirname " $0 " ) "
3542 pwd
3643)
3744
38- cd " ${WORK_DIR} " || exit
45+ cd " ${WORK_DIR} "
3946echo " Current work dir: $( pwd) "
4047
4148# ###############################
4249# Step 1: Download SVN Sources #
4350# ###############################
44- rm -rf " $WORK_DIR " /dist/" $RELEASE_VERSION "
45- svn co ${URL_PREFIX} /" $RELEASE_VERSION " " $WORK_DIR " /dist/" $RELEASE_VERSION "
51+ rm -rf " ${WORK_DIR} /dist/${RELEASE_VERSION} "
52+ mkdir -p " ${WORK_DIR} /dist/${RELEASE_VERSION} "
53+ cd " ${WORK_DIR} /dist/${RELEASE_VERSION} "
54+ svn co " ${SVN_URL_PREFIX} /${RELEASE_VERSION} " .
4655
4756# #################################################
4857# Step 2: Check Environment & Import Public Keys #
4958# #################################################
50- cd " $WORK_DIR " /dist/" $RELEASE_VERSION " || exit
59+ shasum --version 1> /dev/null
60+ gpg --version 1> /dev/null
5161
52- shasum --version 1> /dev/null || exit
53- gpg --version 1> /dev/null || exit
54-
55- wget https://downloads.apache.org/incubator/hugegraph/KEYS || exit
62+ wget https://downloads.apache.org/incubator/hugegraph/KEYS
5663echo " Import KEYS:" && gpg --import KEYS
5764# TODO: how to trust all public keys in gpg list, currently only trust the first one
5865echo -e " 5\ny\n" | gpg --batch --command-fd 0 --edit-key $USER trust
6572# #######################################
6673# Step 3: Check SHA512 & GPG Signature #
6774# #######################################
68- cd " $WORK_DIR " /dist/" $ RELEASE_VERSION" || exit
75+ cd " ${ WORK_DIR} /dist/${ RELEASE_VERSION} "
6976
7077for i in * .tar.gz; do
7178 echo " $i "
72- shasum -a 512 --check " $i " .sha512 || exit
73- eval gpg " ${GPG_OPT} " --verify " $i " .asc " $i " || exit
79+ shasum -a 512 --check " $i " .sha512
80+ eval gpg " ${GPG_OPT} " --verify " $i " .asc " $i "
7481done
7582
7683# ###################################
7784# Step 4: Validate Source Packages #
7885# ###################################
79- cd " $WORK_DIR " /dist/" $ RELEASE_VERSION" || exit
86+ cd " ${ WORK_DIR} /dist/${ RELEASE_VERSION} "
8087
8188CATEGORY_X=" \bGPL|\bLGPL|Sleepycat License|BSD-4-Clause|\bBCL\b|JSR-275|Amazon Software License|\bRSAL\b|\bQPL\b|\bSSPL|\bCPOL|\bNPL1|Creative Commons Non-Commercial"
8289CATEGORY_B=" \bCDDL1|\bCPL|\bEPL|\bIPL|\bMPL|\bSPL|OSL-3.0|UnRAR License|Erlang Public License|\bOFL\b|Ubuntu Font License Version 1.0|IPA Font License Agreement v1.0|EPL2.0|CC-BY"
@@ -89,9 +96,10 @@ for i in *src.tar.gz; do
8996 echo " The package name $i should include incubating" && exit 1
9097 fi
9198
92- tar xzvf " $i " || exit
93- pushd " $( basename " $i " .tar.gz) " || exit
94- echo " Start to check the package content: $( basename " $i " .tar.gz) "
99+ tar -xzvf " $i "
100+ MODULE_DIR=$( basename " $i " .tar.gz)
101+ pushd ${MODULE_DIR}
102+ echo " Start to check the package content: ${MODULE_DIR} "
95103
96104 # 4.2: check the directory include "NOTICE" and "LICENSE" file and "DISCLAIMER" file
97105 if [[ ! -f " LICENSE" ]]; then
@@ -147,68 +155,68 @@ for i in *src.tar.gz; do
147155 # 4.8: test compile the packages
148156 if [[ $JAVA_VERSION == 8 && " $i " =~ " computer" ]]; then
149157 echo " skip computer module in java8"
150- popd || exit
158+ popd
151159 continue
152160 fi
153161 # TODO: consider using commands that are entirely consistent with building binary packages
154- mvn package -DskipTests -Papache-release -ntp -e || exit
162+ mvn package -DskipTests -Papache-release -ntp -e
155163 ls -lh
156164
157- popd || exit
165+ popd
158166done
159167
160168# ##########################################
161- # Step 5: Run Compiled Packages In Server #
169+ # Step 5: Run Compiled Packages of Server #
162170# ##########################################
163- cd " $WORK_DIR " /dist/" $ RELEASE_VERSION" || exit
171+ cd " ${ WORK_DIR} /dist/${ RELEASE_VERSION} "
164172
165173ls -lh
166- pushd ./* hugegraph-incubating* src/hugegraph-server/* hugegraph* " ${RELEASE_VERSION} " || exit
167- bin/init-store.sh || exit
174+ pushd ./* hugegraph-incubating* src/hugegraph-server/* hugegraph* " ${RELEASE_VERSION} "
175+ bin/init-store.sh
168176sleep 3
169- bin/start-hugegraph.sh || exit
170- popd || exit
177+ bin/start-hugegraph.sh
178+ popd
171179
172180# ######################################################################
173- # Step 6: Run Compiled Packages In ToolChain (Loader & Tool & Hubble) #
181+ # Step 6: Run Compiled Packages of ToolChain (Loader & Tool & Hubble) #
174182# ######################################################################
175- cd " $WORK_DIR " /dist/" $ RELEASE_VERSION" || exit
183+ cd " ${ WORK_DIR} /dist/${ RELEASE_VERSION} "
176184
177- pushd ./* toolchain* src || exit
185+ pushd ./* toolchain* src
178186ls -lh
179- pushd ./* toolchain* " ${RELEASE_VERSION} " || exit
187+ pushd ./* toolchain* " ${RELEASE_VERSION} "
180188ls -lh
181189
182190# 6.1: load some data first
183191echo " test loader"
184- pushd ./* loader* " ${RELEASE_VERSION} " || exit
192+ pushd ./* loader* " ${RELEASE_VERSION} "
185193bin/hugegraph-loader.sh -f ./example/file/struct.json -s ./example/file/schema.groovy \
186- -g hugegraph || exit
187- popd || exit
194+ -g hugegraph
195+ popd
188196
189197# 6.2: try some gremlin query & api in tool
190198echo " test tool"
191- pushd ./* tool* " ${RELEASE_VERSION} " || exit
192- bin/hugegraph gremlin-execute --script ' g.V().count()' || exit
193- bin/hugegraph task-list || exit
194- bin/hugegraph backup -t all --directory ./backup-test || exit
195- popd || exit
199+ pushd ./* tool* " ${RELEASE_VERSION} "
200+ bin/hugegraph gremlin-execute --script ' g.V().count()'
201+ bin/hugegraph task-list
202+ bin/hugegraph backup -t all --directory ./backup-test
203+ popd
196204
197205# 6.3: start hubble and connect to server
198206echo " test hubble"
199- pushd ./* hubble* " ${RELEASE_VERSION} " || exit
207+ pushd ./* hubble* " ${RELEASE_VERSION} "
200208# TODO: add hubble doc & test it
201209cat conf/hugegraph-hubble.properties
202- bin/start-hubble.sh || exit
203- bin/stop-hubble.sh || exit
204- popd || exit
210+ bin/start-hubble.sh
211+ bin/stop-hubble.sh
212+ popd
205213
206- popd || exit
207- popd || exit
214+ popd
215+ popd
208216# stop server
209- pushd ./* hugegraph-incubating* src/hugegraph-server/* hugegraph* " ${RELEASE_VERSION} " || exit
210- bin/stop-hugegraph.sh || exit
211- popd || exit
217+ pushd ./* hugegraph-incubating* src/hugegraph-server/* hugegraph* " ${RELEASE_VERSION} "
218+ bin/stop-hugegraph.sh
219+ popd
212220
213221# clear source packages
214222# rm -rf ./*src*
@@ -217,7 +225,7 @@ popd || exit
217225# ###################################
218226# Step 7: Validate Binary Packages #
219227# ###################################
220- cd " $WORK_DIR " /dist/" $ RELEASE_VERSION" || exit
228+ cd " ${ WORK_DIR} /dist/${ RELEASE_VERSION} "
221229
222230for i in * .tar.gz; do
223231 if [[ " $i " == * -src.tar.gz ]]; then
@@ -232,10 +240,11 @@ for i in *.tar.gz; do
232240 echo " The package name $i should include incubating" && exit 1
233241 fi
234242
235- tar xzvf " $i " || exit
236- pushd " $( basename " $i " .tar.gz) " || exit
243+ tar -xzvf " $i "
244+ MODULE_DIR=$( basename " $i " .tar.gz)
245+ pushd ${MODULE_DIR}
237246 ls -lh
238- echo " Start to check the package content: $( basename " $i " .tar.gz ) "
247+ echo " Start to check the package content: ${MODULE_DIR} "
239248
240249 # 7.2: check root dir include "NOTICE"/"LICENSE"/"DISCLAIMER" files & "licenses" dir
241250 if [[ ! -f " LICENSE" ]]; then
@@ -268,57 +277,56 @@ for i in *.tar.gz; do
268277 echo " The package $i shouldn't include empty file: $EMPTY_FILE is empty" && exit 1
269278 done
270279
271- popd || exit
280+ popd
272281done
273282
274283# TODO: skip the following steps by comparing the artifacts built from source packages with binary packages
275284# ########################################
276- # Step 8: Run Binary Packages In Server #
285+ # Step 8: Run Binary Packages of Server #
277286# ########################################
278- cd " $WORK_DIR " /dist/" $ RELEASE_VERSION" || exit
287+ cd " ${ WORK_DIR} /dist/${ RELEASE_VERSION} "
279288
280- pushd ./* hugegraph-incubating* " ${RELEASE_VERSION} " || exit
281- bin/init-store.sh || exit
282- sleep 30
283- bin/start-hugegraph.sh || exit
284- popd || exit
289+ pushd ./* hugegraph-incubating* " ${RELEASE_VERSION} "
290+ bin/init-store.sh
291+ sleep 3
292+ bin/start-hugegraph.sh
293+ popd
285294
286295# ####################################################################
287- # Step 9: Run Binary Packages In ToolChain (Loader & Tool & Hubble) #
296+ # Step 9: Run Binary Packages of ToolChain (Loader & Tool & Hubble) #
288297# ####################################################################
289- cd " $WORK_DIR " /dist/" $ RELEASE_VERSION" || exit
298+ cd " ${ WORK_DIR} /dist/${ RELEASE_VERSION} "
290299
291- pushd ./* toolchain* " ${RELEASE_VERSION} " || exit
300+ pushd ./* toolchain* " ${RELEASE_VERSION} "
292301ls -lh
293302
294303# 9.1: load some data first
295304echo " test loader"
296- pushd ./* loader* " ${RELEASE_VERSION} " || exit
297- bin/hugegraph-loader.sh -f ./example/file/struct.json -s ./example/file/schema.groovy \
298- -g hugegraph || exit
299- popd || exit
305+ pushd ./* loader* " ${RELEASE_VERSION} "
306+ bin/hugegraph-loader.sh -f ./example/file/struct.json -s ./example/file/schema.groovy -g hugegraph
307+ popd
300308
301309# 9.2: try some gremlin query & api in tool
302310echo " test tool"
303- pushd ./* tool* " ${RELEASE_VERSION} " || exit
304- bin/hugegraph gremlin-execute --script ' g.V().count()' || exit
305- bin/hugegraph task-list || exit
306- bin/hugegraph backup -t all --directory ./backup-test || exit
307- popd || exit
311+ pushd ./* tool* " ${RELEASE_VERSION} "
312+ bin/hugegraph gremlin-execute --script ' g.V().count()'
313+ bin/hugegraph task-list
314+ bin/hugegraph backup -t all --directory ./backup-test
315+ popd
308316
309317# 9.3: start hubble and connect to server
310318echo " test hubble"
311- pushd ./* hubble* " ${RELEASE_VERSION} " || exit
319+ pushd ./* hubble* " ${RELEASE_VERSION} "
312320# TODO: add hubble doc & test it
313321cat conf/hugegraph-hubble.properties
314- bin/start-hubble.sh || exit
315- bin/stop-hubble.sh || exit
316- popd || exit
322+ bin/start-hubble.sh
323+ bin/stop-hubble.sh
324+ popd
317325
318- popd || exit
326+ popd
319327# stop server
320- pushd ./* hugegraph-incubating* " ${RELEASE_VERSION} " || exit
321- bin/stop-hugegraph.sh || exit
322- popd || exit
328+ pushd ./* hugegraph-incubating* " ${RELEASE_VERSION} "
329+ bin/stop-hugegraph.sh
330+ popd
323331
324332echo " Finish validate, please check all steps manually again!"
0 commit comments