Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: download apache-zookeeper-3.7.0-bin.tar.gz during release building for unit tests once third-parties have change #1186

Merged
merged 5 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .github/workflows/lint_and_test_cpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
cmake -DCMAKE_BUILD_TYPE=Release -DROCKSDB_PORTABLE=ON -B build/
cmake --build build/ -j $(nproc)
../scripts/download_hadoop.sh hadoop-bin
../scripts/download_zk.sh zookeeper-bin
- name: Compilation
run: |
ccache -p
Expand All @@ -107,8 +108,9 @@ jobs:
- name: Tar files
run: |
mv thirdparty/hadoop-bin ./
mv thirdparty/zookeeper-bin ./
rm -rf thirdparty
tar -zcvhf release__builder.tar DSN_ROOT/ src/builder/bin src/builder/src/server/test/config.ini hadoop-bin --exclude='*CMakeFiles*'
tar -zcvhf release__builder.tar DSN_ROOT/ src/builder/bin src/builder/src/server/test/config.ini hadoop-bin zookeeper-bin --exclude='*CMakeFiles*'
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -212,6 +214,7 @@ jobs:
cmake -DCMAKE_BUILD_TYPE=Release -DROCKSDB_PORTABLE=ON -B build/
cmake --build build/ -j $(nproc)
../scripts/download_hadoop.sh hadoop-bin
../scripts/download_zk.sh zookeeper-bin
- name: Compilation
run: |
ccache -p
Expand All @@ -221,8 +224,9 @@ jobs:
- name: Tar files
run: |
mv thirdparty/hadoop-bin ./
mv thirdparty/zookeeper-bin ./
rm -rf thirdparty
tar -zcvhf release_address_builder.tar DSN_ROOT/ src/builder/bin src/builder/src/server/test/config.ini hadoop-bin --exclude='*CMakeFiles*'
tar -zcvhf release_address_builder.tar DSN_ROOT/ src/builder/bin src/builder/src/server/test/config.ini hadoop-bin zookeeper-bin --exclude='*CMakeFiles*'
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -331,6 +335,7 @@ jobs:
# cmake -DCMAKE_BUILD_TYPE=Release -DROCKSDB_PORTABLE=ON -B build/
# cmake --build build/ -j $(nproc)
# ../scripts/download_hadoop.sh hadoop-bin
# ../scripts/download_zk.sh zookeeper-bin
# - name: Compilation
# run: |
# ccache -p
Expand All @@ -340,8 +345,9 @@ jobs:
# - name: Tar files
# run: |
# mv thirdparty/hadoop-bin ./
# mv thirdparty/zookeeper-bin ./
# rm -rf thirdparty
# tar -zcvhf release_undefined_builder.tar DSN_ROOT/ src/builder/bin src/builder/src/server/test/config.ini hadoop-bin --exclude='*CMakeFiles*'
# tar -zcvhf release_undefined_builder.tar DSN_ROOT/ src/builder/bin src/builder/src/server/test/config.ini hadoop-bin zookeeper-bin --exclude='*CMakeFiles*'
# - name: Upload Artifact
# uses: actions/upload-artifact@v3
# with:
Expand Down Expand Up @@ -443,6 +449,7 @@ jobs:
cmake -DCMAKE_BUILD_TYPE=Release -DROCKSDB_PORTABLE=ON -DUSE_JEMALLOC=ON -B build/
cmake --build build/ -j $(nproc)
../scripts/download_hadoop.sh hadoop-bin
../scripts/download_zk.sh zookeeper-bin
- name: Compilation
run: |
ccache -p
Expand All @@ -456,8 +463,9 @@ jobs:
- name: Tar files
run: |
mv thirdparty/hadoop-bin ./
mv thirdparty/zookeeper-bin ./
rm -rf thirdparty
tar -zcvhf release_jemalloc_builder.tar DSN_ROOT/ src/builder/bin src/builder/src/server/test/config.ini hadoop-bin --exclude='*CMakeFiles*'
tar -zcvhf release_jemalloc_builder.tar DSN_ROOT/ src/builder/bin src/builder/src/server/test/config.ini hadoop-bin zookeeper-bin --exclude='*CMakeFiles*'
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
Expand Down
7 changes: 7 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,13 @@ function run_start_zk()
type nc >/dev/null 2>&1 || { echo >&2 "start zk failed, need install netcat command..."; exit 1;}

INSTALL_DIR=`pwd`/.zk_install
if [ ! -d "${INSTALL_DIR}/zookeeper-bin" ]; then
if [ -d "zookeeper-bin" ]; then
# this zookeeper-bin must have been got from github action workflows, thus just
# move it to ${INSTALL_DIR} to prevent from downloading
mv zookeeper-bin ${INSTALL_DIR}/
fi
fi
PORT=22181
while [[ $# > 0 ]]; do
key="$1"
Expand Down
15 changes: 11 additions & 4 deletions scripts/clear_zk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,16 @@ fi
cd $INSTALL_DIR
ZOOKEEPER_HOME=`pwd`/apache-zookeeper-3.7.0-bin

if [ -d "$ZOOKEEPER_HOME" ]
then
$ZOOKEEPER_HOME/bin/zkServer.sh stop
rm -rf $ZOOKEEPER_HOME/data &>/dev/null
if [ -d "${ZOOKEEPER_HOME}" ]; then
${ZOOKEEPER_HOME}/bin/zkServer.sh stop
rm -rf ${ZOOKEEPER_HOME} &> /dev/null
echo "Deleting old zookeeper ... DELETED"
fi

ZOOKEEPER_HOME=`pwd`/zookeeper-bin

if [ -d "${ZOOKEEPER_HOME}" ]; then
${ZOOKEEPER_HOME}/bin/zkServer.sh stop
rm -rf ${ZOOKEEPER_HOME}/data &> /dev/null
echo "Clearing zookeeper ... CLEARED"
fi
5 changes: 5 additions & 0 deletions scripts/download_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,9 @@ if [ ! -d ${DIR_NAME} ]; then
exit 1
fi

if [ -d ${TARGET_PATH} ]; then
echo "TARGET_PATH ${TARGET_PATH} has been generated, which means it and ${DIR_NAME} are the same dir thus do not do mv any more"
exit 0
fi

mv ${DIR_NAME} ${TARGET_PATH}
29 changes: 6 additions & 23 deletions scripts/start_zk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

set -e

CWD=$(cd $(dirname $0) && pwd)

# Options:
# INSTALL_DIR <dir>
# PORT <port>
Expand All @@ -42,32 +44,13 @@ fi

cd "$INSTALL_DIR" || exit

ZOOKEEPER_ROOT=apache-zookeeper-3.7.0-bin
ZOOKEEPER_TAR_NAME=${ZOOKEEPER_ROOT}.tar.gz
ZOOKEEPER_TAR_MD5_VALUE="8ffa97e7e6b0b2cf1d022e5156a7561a"
ZOOKEEPER_HOME=`pwd`/apache-zookeeper-3.7.0-bin

if [ ! -f $ZOOKEEPER_TAR_NAME ]; then
echo "Downloading zookeeper..."
download_url="http://pegasus-thirdparty-package.oss-cn-beijing.aliyuncs.com/apache-zookeeper-3.7.0-bin.tar.gz"
if ! wget -T 10 -t 5 $download_url; then
echo "ERROR: download zookeeper failed"
exit 1
fi
if [ `md5sum $ZOOKEEPER_TAR_NAME | awk '{print$1}'` != $ZOOKEEPER_TAR_MD5_VALUE ]; then
echo "check file $ZOOKEEPER_TAR_NAME md5sum failed!"
exit 1
fi
fi

if [ ! -d $ZOOKEEPER_ROOT ]; then
echo "Decompressing zookeeper..."
if ! tar xf $ZOOKEEPER_TAR_NAME; then
echo "ERROR: decompress zookeeper failed"
exit 1
fi
if [ ! -d "${ZOOKEEPER_HOME}" ]; then
${CWD}/download_zk.sh zookeeper-bin
ZOOKEEPER_HOME=`pwd`/zookeeper-bin
fi

ZOOKEEPER_HOME=`pwd`/$ZOOKEEPER_ROOT
ZOOKEEPER_PORT=$PORT

cp $ZOOKEEPER_HOME/conf/zoo_sample.cfg $ZOOKEEPER_HOME/conf/zoo.cfg
Expand Down
9 changes: 6 additions & 3 deletions scripts/stop_zk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ fi
cd $INSTALL_DIR
ZOOKEEPER_HOME=`pwd`/apache-zookeeper-3.7.0-bin

if [ -d "$ZOOKEEPER_HOME" ]
then
$ZOOKEEPER_HOME/bin/zkServer.sh stop
if [ ! -d "${ZOOKEEPER_HOME}" ]; then
ZOOKEEPER_HOME=`pwd`/zookeeper-bin
fi

if [ -d "${ZOOKEEPER_HOME}" ]; then
${ZOOKEEPER_HOME}/bin/zkServer.sh stop
fi