From fc914d1fd0897ef72212f191fae67b04571864bc Mon Sep 17 00:00:00 2001 From: emma Date: Thu, 7 Mar 2024 16:50:43 -0500 Subject: [PATCH] rename "browsertrix" to "browsertrix cloud" in init shell script (and format with shfmt) --- btrix | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/btrix b/btrix index b424e29273..f69f6ddf72 100755 --- a/btrix +++ b/btrix @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# ./btrix: Browsertrix Cloud dev environment utility +# ./btrix: Browsertrix dev environment utility # # Test commands require installing pytest first, e.g.: # python3 -m pip install pytest @@ -34,8 +34,7 @@ # $ ./btrix nightly # Run nightly backend tests - -bootstrap(){ +bootstrap() { echo "Building backend..." ./scripts/build-backend.sh @@ -46,7 +45,7 @@ bootstrap(){ helm upgrade --install -f ./chart/values.yaml -f ./chart/local.yaml btrix ./chart } -bootstrapMicrok8s(){ +bootstrapMicrok8s() { echo "Building backend..." ./scripts/build-backend.sh @@ -57,17 +56,17 @@ bootstrapMicrok8s(){ microk8s helm3 upgrade --install -f ./chart/values.yaml -f ./chart/local.yaml btrix ./chart } -waitUntilReady(){ +waitUntilReady() { echo "Waiting until ready..." kubectl wait --for=condition=ready pod --all --timeout=300s } -waitUntilReadyMicrok8s(){ +waitUntilReadyMicrok8s() { echo "Waiting until ready..." microk8s kubectl wait --for=condition=ready pod --all --timeout=300s } -reset(){ +reset() { echo "Stopping all crawls & profile browsers" kubectl delete cjs -n crawlers --all kubectl delete pjs -n crawlers --all @@ -81,7 +80,7 @@ reset(){ kubectl delete configmap -n crawlers -l btrix.crawlconfig } -resetMicrok8s(){ +resetMicrok8s() { echo "Stopping all crawls & profile browsers" microk8s kubectl delete cjs -n crawlers --all microk8s kubectl delete pjs -n crawlers --all @@ -134,22 +133,24 @@ if [[ $1 = "bootstrap" ]]; then echo "Current context: $CONTEXT" echo "Are you sure you want to update this context?" - if [[ "$(read -e -p '[y/N] > '; echo $REPLY)" == [Yy]* ]] ; then + if [[ "$( + read -e -p '[y/N] > ' + echo $REPLY + )" == [Yy]* ]]; then echo Continuing else echo Stopping exit 1 fi - if [[ $2 = "$MICROK8S" || $3 = "$MICROK8S" ]] ; then + if [[ $2 = "$MICROK8S" || $3 = "$MICROK8S" ]]; then bootstrapMicrok8s else bootstrap fi - if [[ $2 = "$WAIT" || $3 = "$WAIT" ]]; then - if [[ $2 = "$MICROK8S" || $3 = "$MICROK8S" ]] ; then + if [[ $2 = "$MICROK8S" || $3 = "$MICROK8S" ]]; then waitUntilReadyMicrok8s else waitUntilReady @@ -159,17 +160,20 @@ fi # reset: uninstall, delete data, then bootstrap if [[ $1 = "reset" ]]; then - + echo "Current context: $CONTEXT" echo "Resetting k8s cluster will delete the database. All running crawls will first be canceled. Are you sure you want to do this?" - if [[ "$(read -e -p '[y/N] > '; echo $REPLY)" == [Yy]* ]] ; then + if [[ "$( + read -e -p '[y/N] > ' + echo $REPLY + )" == [Yy]* ]]; then echo Continuing else echo Stopping exit 1 fi - if [[ $2 = "$MICROK8S" || $3 = "$MICROK8S" ]] ; then + if [[ $2 = "$MICROK8S" || $3 = "$MICROK8S" ]]; then resetMicrok8s bootstrapMicrok8s else @@ -177,8 +181,8 @@ if [[ $1 = "reset" ]]; then bootstrap fi - if [[ $2 = "$WAIT" || $3 = "$WAIT" ]] ; then - if [[ $2 = "$MICROK8S" || $3 = "$MICROK8S" ]] ; then + if [[ $2 = "$WAIT" || $3 = "$WAIT" ]]; then + if [[ $2 = "$MICROK8S" || $3 = "$MICROK8S" ]]; then waitUntilReadyMicrok8s else waitUntilReady @@ -196,9 +200,9 @@ if [[ $1 = "nightly" ]]; then runNightlyTests fi -# down: stop and uninstall browsertrix cloud +# down: stop and uninstall browsertrix if [[ $1 = "down" ]]; then - if [[ $2 = "$MICROK8S" ]] ; then + if [[ $2 = "$MICROK8S" ]]; then resetMicrok8s else reset