Improve output formatting for build-and-deploy

Also restore the pvcnoded restart that was erroneously removed.
This commit is contained in:
Joshua Boniface 2024-01-10 14:22:12 -05:00
parent 362edeed8c
commit 38eeb78423
1 changed files with 12 additions and 11 deletions

View File

@ -25,28 +25,29 @@ if [[ -n ${1} ]]; then
fi fi
HOSTS=( ${@} ) HOSTS=( ${@} )
echo "> Deploying to host(s): ${HOSTS[@]}" echo "Deploying to host(s): ${HOSTS[@]}"
# Move to repo root if we're not # Move to repo root if we're not
pushd $( git rev-parse --show-toplevel ) &>/dev/null pushd $( git rev-parse --show-toplevel ) &>/dev/null
# Prepare code # Prepare code
echo "Preparing code (format and lint)..." echo "> Preparing code (format and lint)..."
./format || exit 1 ./format || exit 1
./lint || exit 1 ./lint || exit 1
# Build the packages # Build the packages
echo -n "Building packages..." echo -n "> Building packages..."
version="$( ./build-unstable-deb.sh 2>/dev/null )" version="$( ./build-unstable-deb.sh 2>/dev/null )"
echo " done. Package version ${version}." echo " done. Package version ${version}."
# Install the client(s) locally # Install the client(s) locally
echo -n "Installing client packages locally..." echo -n "> Installing client packages locally..."
$SUDO dpkg -i --force-all ../pvc-client*_${version}*.deb &>/dev/null $SUDO dpkg -i --force-all ../pvc-client*_${version}*.deb &>/dev/null
echo " done". echo " done".
echo "> Copying packages..."
for HOST in ${HOSTS[@]}; do for HOST in ${HOSTS[@]}; do
echo -n "Copying packages to host ${HOST}..." echo -n ">>> Copying packages to host ${HOST}..."
ssh $HOST $SUDO rm -rf /tmp/pvc &>/dev/null ssh $HOST $SUDO rm -rf /tmp/pvc &>/dev/null
ssh $HOST mkdir /tmp/pvc &>/dev/null ssh $HOST mkdir /tmp/pvc &>/dev/null
scp ../pvc-*_${version}*.deb $HOST:/tmp/pvc/ &>/dev/null scp ../pvc-*_${version}*.deb $HOST:/tmp/pvc/ &>/dev/null
@ -57,21 +58,21 @@ if [[ -z ${KEEP_ARTIFACTS} ]]; then
fi fi
for HOST in ${HOSTS[@]}; do for HOST in ${HOSTS[@]}; do
echo "> Deploying packages to host ${HOST}" echo "> Deploying packages on host ${HOST}"
echo -n "Installing packages..." echo -n ">>> Installing packages..."
ssh $HOST $SUDO dpkg -i --force-all /tmp/pvc/*.deb &>/dev/null ssh $HOST $SUDO dpkg -i --force-all /tmp/pvc/*.deb &>/dev/null
ssh $HOST rm -rf /tmp/pvc &>/dev/null ssh $HOST rm -rf /tmp/pvc &>/dev/null
echo " done." echo " done."
echo -n "Restarting PVC daemons..." echo -n ">>> Restarting PVC daemons..."
ssh $HOST $SUDO systemctl restart pvcapid &>/dev/null ssh $HOST $SUDO systemctl restart pvcapid &>/dev/null
sleep 2 sleep 2
ssh $HOST $SUDO systemctl restart pvcworkerd &>/dev/null ssh $HOST $SUDO systemctl restart pvcworkerd &>/dev/null
sleep 2 sleep 2
ssh $HOST $SUDO systemctl restart pvchealthd &>/dev/null ssh $HOST $SUDO systemctl restart pvchealthd &>/dev/null
# sleep 2 sleep 2
# ssh $HOST $SUDO systemctl restart pvcnoded &>/dev/null ssh $HOST $SUDO systemctl restart pvcnoded &>/dev/null
echo " done." echo " done."
echo -n "Waiting for node daemon to be running..." echo -n ">>> Waiting for node daemon to be running..."
while [[ $( ssh $HOST "pvc -q node list -f json ${HOST%%.*} | jq -r '.[].daemon_state'" 2>/dev/null ) != "run" ]]; do while [[ $( ssh $HOST "pvc -q node list -f json ${HOST%%.*} | jq -r '.[].daemon_state'" 2>/dev/null ) != "run" ]]; do
sleep 5 sleep 5
echo -n "." echo -n "."