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

fix(install): Use proper bash testing #673

Merged
merged 4 commits into from
Sep 14, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
Use -n and -z when testing for empty and not
  • Loading branch information
RichardBronosky committed Sep 12, 2020
commit bbba939ed00528aa5062fc6fcb0b07b6c67b76f1
8 changes: 4 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ cleanup () {
if [[ "$1" != "EXIT" ]]; then
echo "An error occurred, caught SIG$1 on line $2";

if [[ "$MINIMIZE_DOWNTIME" ]]; then
if [[ -n "$MINIMIZE_DOWNTIME" ]]; then
echo "*NOT* cleaning up, to clean your environment run \"docker-compose stop\"."
else
echo "Cleaning up..."
fi
fi

if [[ ! "$MINIMIZE_DOWNTIME" ]]; then
if [[ -z "$MINIMIZE_DOWNTIME" ]]; then
$dc stop &> /dev/null
fi
}
Expand Down Expand Up @@ -218,7 +218,7 @@ $dc build --force-rm --parallel
echo ""
echo "Docker images built."

if [[ "$MINIMIZE_DOWNTIME" ]]; then
if [[ -n "$MINIMIZE_DOWNTIME" ]]; then
# Stop everything but relay and nginx
$dc rm -fsv $($dc config --services | grep -v -E '^(nginx|relay)$')
else
Expand Down Expand Up @@ -246,7 +246,7 @@ $dcr snuba-api migrations migrate --force
echo ""

# Very naively check whether there's an existing sentry-postgres volume and the PG version in it
if [[ $(docker volume ls -q --filter name=sentry-postgres) && $(docker run --rm -v sentry-postgres:/db busybox cat /db/PG_VERSION 2>/dev/null) == "9.5" ]]; then
if [[ -n "$(docker volume ls -q --filter name=sentry-postgres)" && "$(docker run --rm -v sentry-postgres:/db busybox cat /db/PG_VERSION 2>/dev/null)" == "9.5" ]]; then
docker volume rm sentry-postgres-new || true
# If this is Postgres 9.5 data, start upgrading it to 9.6 in a new volume
docker run --rm \
Expand Down