scripts: cleanup rolling upgrade test

* add script for easy rolling upgrade test local execution
* remove unneeded binaries building for rolling upgrade and versions
tests
* unify build process for Jenkins and local execution for rolling
upgrade and versions tests

Change-Id: Ic11211b83f3f447494bbd5827d2af77ea4b20dfe
This commit is contained in:
Michal Niewrzal 2020-03-31 11:07:41 +02:00
parent 473cd4695f
commit d444fbadea
4 changed files with 42 additions and 34 deletions

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cleanup(){
docker rm -f postgres-$BUILD_NUMBER
docker rm -f redis-$BUILD_NUMBER
}
trap cleanup EXIT
# TODO somehow provide `shasum` binary
BUILD_NUMBER="dev"
export STORJ_SIM_POSTGRES="postgres://postgres@localhost:5433/teststorj?sslmode=disable"
export STORJ_SIM_REDIS="localhost:6380"
docker run --rm -d -p 5433:5432 -e POSTGRES_HOST_AUTH_METHOD=trust --name postgres-$BUILD_NUMBER postgres:9.6
docker run --rm -d -p 6380:6379 --name redis-$BUILD_NUMBER redis:latest
until $(docker logs postgres-$BUILD_NUMBER | grep "database system is ready to accept connections" > /dev/null)
do printf '.'
sleep 5
done
docker exec postgres-$BUILD_NUMBER createdb -U postgres teststorj
# fetch the remote master branch
git fetch --no-tags --progress -- https://github.com/storj/storj.git +refs/heads/master:refs/remotes/origin/master
$SCRIPTDIR/test-sim-rolling-upgrade.sh

View File

@ -93,11 +93,6 @@ install_sim(){
local bin_dir="$2"
mkdir -p ${bin_dir}
go build -race -v -tags=grpc -o ${bin_dir}/storagenode-grpc storj.io/storj/cmd/storagenode >/dev/null 2>&1
go build -race -v -tags=drpc -o ${bin_dir}/storagenode-drpc storj.io/storj/cmd/storagenode >/dev/null 2>&1
go build -race -v -tags=grpc -o ${bin_dir}/satellite-grpc storj.io/storj/cmd/satellite >/dev/null 2>&1
go build -race -v -tags=drpc -o ${bin_dir}/satellite-drpc storj.io/storj/cmd/satellite >/dev/null 2>&1
go build -race -v -o ${bin_dir}/storagenode storj.io/storj/cmd/storagenode >/dev/null 2>&1
go build -race -v -o ${bin_dir}/satellite storj.io/storj/cmd/satellite >/dev/null 2>&1
go build -race -v -o ${bin_dir}/storj-sim storj.io/storj/cmd/storj-sim >/dev/null 2>&1
@ -210,10 +205,9 @@ for version in ${unique_versions}; do
then
echo "Installing storj-sim for ${version} in ${dir}."
pushd ${dir}
# uncomment for Jenkins testing:
install_sim ${dir} ${bin_dir}
# uncomment for local testing:
# GOBIN=${bin_dir} make -C "${dir}" install-sim > /dev/null 2>&1
echo "finished installing"
popd
echo "Setting up storj-sim for ${version}. Bin: ${bin_dir}, Config: ${dir}/local-network"
@ -228,10 +222,9 @@ for version in ${unique_versions}; do
echo "Installing uplink for ${version} in ${dir}."
pushd ${dir}
mkdir -p ${bin_dir}
# uncomment for Jenkins testing:
go install -race -v -o ${bin_dir}/uplink storj.io/storj/cmd/uplink >/dev/null 2>&1
# uncomment for local testing:
# GOBIN=${bin_dir} go install -race -v storj.io/storj/cmd/uplink > /dev/null 2>&1
go build -race -v -o ${bin_dir}/uplink storj.io/storj/cmd/uplink >/dev/null 2>&1
popd
echo "Finished installing. ${bin_dir}:" $(ls ${bin_dir})
echo "Binary shasums:"

View File

@ -26,4 +26,4 @@ done
docker exec postgres-$BUILD_NUMBER createdb -U postgres teststorj
# fetch the remote master branch
git fetch --no-tags --progress -- https://github.com/storj/storj.git +refs/heads/master:refs/remotes/origin/master
RUN_TYPE=local $SCRIPTDIR/test-sim-versions.sh
$SCRIPTDIR/test-sim-versions.sh

View File

@ -73,11 +73,6 @@ install_sim(){
local bin_dir="$2"
mkdir -p ${bin_dir}
go build -race -v -tags=grpc -o ${bin_dir}/storagenode-grpc storj.io/storj/cmd/storagenode >/dev/null 2>&1
go build -race -v -tags=drpc -o ${bin_dir}/storagenode-drpc storj.io/storj/cmd/storagenode >/dev/null 2>&1
go build -race -v -tags=grpc -o ${bin_dir}/satellite-grpc storj.io/storj/cmd/satellite >/dev/null 2>&1
go build -race -v -tags=drpc -o ${bin_dir}/satellite-drpc storj.io/storj/cmd/satellite >/dev/null 2>&1
go build -race -v -o ${bin_dir}/storagenode storj.io/storj/cmd/storagenode >/dev/null 2>&1
go build -race -v -o ${bin_dir}/satellite storj.io/storj/cmd/satellite >/dev/null 2>&1
go build -race -v -o ${bin_dir}/storj-sim storj.io/storj/cmd/storj-sim >/dev/null 2>&1
@ -183,16 +178,11 @@ for version in ${unique_versions}; do
if [[ $version = $current_release_version || $version = "master" ]]
then
echo "Installing storj-sim for ${version} in ${dir}."
pushd ${dir}
if [ "$RUN_TYPE" = "jenkins" ]; then
install_sim ${dir} ${bin_dir}
fi
install_sim ${dir} ${bin_dir}
echo "finished installing"
popd
# for local testing
if [ "$RUN_TYPE" != "jenkins" ]; then
GOBIN=${bin_dir} make -C ${dir} install-sim >/dev/null 2>&1
fi
echo "Setting up storj-sim for ${version}. Bin: ${bin_dir}, Config: ${dir}/local-network"
PATH=${bin_dir}:$PATH storj-sim -x --host="${STORJ_NETWORK_HOST4}" --postgres="${STORJ_SIM_POSTGRES}" --config-dir "${dir}/local-network" network setup > /dev/null 2>&1
echo "Finished setting up. ${dir}/local-network:" $(ls ${dir}/local-network)
@ -205,13 +195,9 @@ for version in ${unique_versions}; do
echo "Installing uplink for ${version} in ${dir}."
pushd ${dir}
mkdir -p ${bin_dir}
if [ "$RUN_TYPE" = "jenkins" ]; then
go install -race -v -o ${bin_dir}/uplink storj.io/storj/cmd/uplink >/dev/null 2>&1
fi
# for local testing
if [ "$RUN_TYPE" != "jenkins" ]; then
GOBIN=${bin_dir} go install -race -v storj.io/storj/cmd/uplink >/dev/null 2>&1
fi
go build -race -v -o ${bin_dir}/uplink storj.io/storj/cmd/uplink >/dev/null 2>&1
popd
echo "Finished installing. ${bin_dir}:" $(ls ${bin_dir})
echo "Binary shasums:"