1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

add app install to installer; fix ci test script

This commit is contained in:
checktheroads
2020-02-23 10:09:24 -07:00
parent 2277b21dc0
commit 24da166d62
2 changed files with 63 additions and 19 deletions

View File

@@ -1,18 +1,40 @@
#!/bin/sh -l
get_status () {
echo $(curl -s -o /dev/null -w "%{http_code}" http://localhost:8001)
}
echo "[INFO] Starting Redis..."
redis-server &
cd /tmp/hyperglass
echo "Starting setup..."
echo "[INFO] Starting setup..."
poetry run hyperglass setup -d
echo "Setup completed"
echo "[SUCCESS] Setup completed."
sleep 2
echo "Starting UI build"
echo "[INFO] Starting UI build."
poetry run hyperglass build-ui
echo "UI build completed"
echo "Starting hyperglass..."
echo "[SUCCESS] UI build completed."
echo "[INFO] Starting hyperglass..."
poetry run hyperglass start &> /var/log/hyperglassci.log &
sleep 10
echo "Started hyperglass"
echo "Running HTTP test..."
echo "Status code:"
curl -s -o /dev/null -w "%{http_code}" http://localhost:8001
echo "\nTests ran successfully"
if [[ ! $? == 0 ]]; then
echo "[ERROR] Failed to start hyperglass."
exit 1
fi
echo "[SUCCESS] Started hyperglass."
echo "[INFO] Running HTTP test..."
echo "[INFO] Status code: $(get_status)"
if [[ ! $? == 0 ]]; then
echo "[ERROR] HTTP test failed."
exit 1
fi
echo "[SUCCESS] Tests ran successfully."
exit 0

View File

@@ -16,6 +16,7 @@ BREW_UPDATE="brew update"
INSTALL_MAP=(["apt"]="$APT_INSTALL" ["yum"]="$YUM_INSTALL" ["brew"]="$BREW_INSTALL")
UPDATE_MAP=(["apt"]="$APT_UPDATE" ["yum"]="$YUM_UPDATE" ["brew"]="$BREW_UPDATE")
APP_TARGET="git+https://github.com/checktheroads/hyperglass.git@v1.0.0"
INSTALLER=""
NEEDS_UPDATE="0"
NEEDS_PYTHON="1"
@@ -33,6 +34,17 @@ has_cmd () {
fi
}
clean_temp () {
echo "Cleaning up temporary files..."
rm -rf /tmp/yarnkey.gpg
rm -rf /tmp/nodesetup.sh
}
catch_interrupt () {
kill $PID
exit
}
semver () {
local ver_raw=$(echo "$1" | egrep -o '\d+\.\d+\.\d+')
local ver_digits=( ${ver_raw//./ } )
@@ -388,15 +400,21 @@ install_redis () {
fi
}
clean_temp () {
echo "Cleaning up temporary files..."
rm -rf /tmp/yarnkey.gpg
rm -rf /tmp/nodesetup.sh
}
install_app () {
echo "[INFO] Installing hyperglass..."
pip3 install $APP_TARGET
catch_interrupt () {
kill $PID
exit
if [[ ! $? == 0 ]]; then
echo "[ERROR] An error occurred while trying to install hyperglass."
else
local successful=$(has_cmd "hyperglass")
if [[ successful == 0 ]]; then
echo "[SUCCESS] Installed hyperglass."
else
echo "[ERROR] hyperglass installation succeeded, but the hyperglass command was not found."
exit 1
fi
fi
}
trap catch_interrupt SIGINT
@@ -440,10 +458,14 @@ while true; do
if [[ $? == 0 ]]; then
clean_temp
echo "[SUCCESS] Finished installed dependencies."
exit 0
else
clean_temp
echo "[ERROR] An error occurred while attempting to install dependencies."
exit 1
fi
install_app
echo 'hyperglass installation was successful! You can now run `hyperglass --help` to see available commands.'
exit 0
done