From edb2171d616a9cc39a10ae2e1d8952de58e29e64 Mon Sep 17 00:00:00 2001 From: Alex Castillo Date: Wed, 4 Nov 2026 17:23:27 -0400 Subject: [PATCH 1/2] fix(install): create the PostgreSQL volume without --name Podman's `volume create` takes the name as a positional argument and has no --name flag, so the volume swap in upgrade-postgres.sh aborted with exit 125 after the old sentry-postgres volume was already removed. Docker accepts the positional form too. Co-Authored-By: Claude Sonnet 5.5 --- .../upgrade-postgres-volume-create-test.sh | 40 +++++++++++++++++++ install/upgrade-postgres.sh | 4 +- 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100755 _unit-test/upgrade-postgres-volume-create-test.sh diff --git a/_unit-test/upgrade-postgres-volume-create-test.sh b/_unit-test/upgrade-postgres-volume-create-test.sh new file mode 100755 index 000000000..6489e42ba --- /dev/null +++ b/_unit-test/upgrade-postgres-volume-create-test.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +source _unit-test/_test_setup.sh + +# Podman's `volume create` takes the name as a positional argument and has no +# --name flag, so the volume swap in upgrade-postgres.sh must not use it. + +stub_dir="$_SANDBOX/stub" +mkdir -p "$stub_dir" +engine_log="$stub_dir/engine.log" +: >"$engine_log" + +cat >"$stub_dir/engine" <<'STUB' +#!/usr/bin/env bash +echo "$*" >>"$ENGINE_LOG" +case "$*" in +"volume create --name"*) + echo "Error: unknown flag: --name" >&2 + exit 125 + ;; +"volume inspect"*) exit 1 ;; +"volume ls"*) exit 0 ;; +"run"*"busybox sh -c"*) echo 14 ;; +"run"*"busybox test -f"*) exit 1 ;; +esac +exit 0 +STUB +chmod +x "$stub_dir/engine" + +export ENGINE_LOG="$engine_log" +export CONTAINER_ENGINE="$stub_dir/engine" +_group="" +_endgroup="" + +source install/upgrade-postgres.sh >/dev/null + +grep -q '^volume create sentry-postgres$' "$engine_log" +! grep -q 'volume create --name' "$engine_log" + +report_success diff --git a/install/upgrade-postgres.sh b/install/upgrade-postgres.sh index 917eb83be..37e24bee4 100644 --- a/install/upgrade-postgres.sh +++ b/install/upgrade-postgres.sh @@ -12,7 +12,7 @@ if [[ -n "$($CONTAINER_ENGINE volume ls -q --filter name=sentry-postgres)" && "$ # Get rid of the old volume as we'll rename the new one to that $CONTAINER_ENGINE volume rm sentry-postgres - $CONTAINER_ENGINE volume create --name sentry-postgres + $CONTAINER_ENGINE volume create sentry-postgres # There's no rename volume in Docker so copy the contents from old to new name # Also append the `host all all all trust` line as `tianon/postgres-upgrade:9.6-to-14` # doesn't do that automatically. @@ -74,7 +74,7 @@ if [[ "$postgres_version" == "14" ]]; then echo "[2/2] pg_upgrade completed. Replacing the PostgreSQL 14 volume with PostgreSQL 18 data..." $CONTAINER_ENGINE volume rm sentry-postgres - $CONTAINER_ENGINE volume create --name sentry-postgres + $CONTAINER_ENGINE volume create sentry-postgres $CONTAINER_ENGINE run --rm -v sentry-postgres-new:/from -v sentry-postgres:/to alpine ash -ec \ "mkdir -p /to/18/docker; cp -av /from/. /to/18/docker; echo 'host all all all trust' >> /to/18/docker/pg_hba.conf" $CONTAINER_ENGINE volume rm sentry-postgres-new From 5837b0097a7eb091e782f7ab906d2c19dc1572e6 Mon Sep 17 00:00:00 2001 From: Alex Castillo Date: Thu, 5 Nov 2026 10:37:47 -0400 Subject: [PATCH 2/2] chore: remove unit test for postgres volume create (per review) --- .../upgrade-postgres-volume-create-test.sh | 40 ------------------- 1 file changed, 40 deletions(-) delete mode 100755 _unit-test/upgrade-postgres-volume-create-test.sh diff --git a/_unit-test/upgrade-postgres-volume-create-test.sh b/_unit-test/upgrade-postgres-volume-create-test.sh deleted file mode 100755 index 6489e42ba..000000000 --- a/_unit-test/upgrade-postgres-volume-create-test.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash - -source _unit-test/_test_setup.sh - -# Podman's `volume create` takes the name as a positional argument and has no -# --name flag, so the volume swap in upgrade-postgres.sh must not use it. - -stub_dir="$_SANDBOX/stub" -mkdir -p "$stub_dir" -engine_log="$stub_dir/engine.log" -: >"$engine_log" - -cat >"$stub_dir/engine" <<'STUB' -#!/usr/bin/env bash -echo "$*" >>"$ENGINE_LOG" -case "$*" in -"volume create --name"*) - echo "Error: unknown flag: --name" >&2 - exit 125 - ;; -"volume inspect"*) exit 1 ;; -"volume ls"*) exit 0 ;; -"run"*"busybox sh -c"*) echo 14 ;; -"run"*"busybox test -f"*) exit 1 ;; -esac -exit 0 -STUB -chmod +x "$stub_dir/engine" - -export ENGINE_LOG="$engine_log" -export CONTAINER_ENGINE="$stub_dir/engine" -_group="" -_endgroup="" - -source install/upgrade-postgres.sh >/dev/null - -grep -q '^volume create sentry-postgres$' "$engine_log" -! grep -q 'volume create --name' "$engine_log" - -report_success