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

scripts: make all scripts that need it use realpath #9590

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion scripts/cleanup-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ if [ "$#" -ne 0 ]; then
exit 1
fi

root_path="$(realpath $(dirname "$0")/..)"

# These variables are necessary to load the infra on the correct instance (the pr-infra or the dev one)
OSRD_POSTGRES="osrd-postgres"
OSRD_EDITOAST="osrd-editoast"
Expand Down Expand Up @@ -77,4 +79,4 @@ docker exec "$OSRD_VALKEY" valkey-cli -p "$OSRD_VALKEY_PORT" FLUSHALL > /dev/nul

echo "Cleanup done!\n"
echo "You may want to apply migrations if you don't load a backup:"
echo "'diesel migration run --migration-dir $(dirname $0)/../editoast/migrations' # 'docker compose up editoast' does it automatically"
echo "'diesel migration run --migration-dir \"$root_path/editoast/migrations\"' # 'docker compose up editoast' does it automatically"
4 changes: 3 additions & 1 deletion scripts/load-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ if [ "$#" -ne 1 ]; then
exit 1
fi

root_path="$(realpath $(dirname "$0")/..)"

# Check sha1 is matching
echo "Checking backup integrity..."
BACKUP_PATH="$1"
Expand Down Expand Up @@ -44,7 +46,7 @@ if [ "$PR_TEST" -eq 1 ]; then
OSRD_POSTGRES_PORT=5433
fi

$(dirname "$0")/cleanup-db.sh # Cleanup and init db (no migration)
"$root_path"/scripts/cleanup-db.sh # Cleanup and init db (no migration)

# Copy needed files to the container
docker cp "$BACKUP_PATH" "$OSRD_POSTGRES:tmp/backup-osrd"
Expand Down
Loading