From 043cb26a61241d8c6de1252ee4b8c695c1ba4b44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Hagberg?= Date: Wed, 31 Jul 2024 14:52:28 +0200 Subject: [PATCH] Make psql.sh support podman --- .github/workflows/ci.yaml | 8 ++++---- ci/docker/psql.sh | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1ab9e5f..03d0c7f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest services: postgres: - image: postgres:11 + image: postgres:15 env: POSTGRES_USER: nivlheim POSTGRES_DB: nivlheim @@ -47,7 +47,7 @@ jobs: - name: Docker save run: docker save nivlheim | gzip > nivlheim-image.tar.gz - name: Upload artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: nivlheim-image.tar.gz path: nivlheim-image.tar.gz @@ -105,9 +105,9 @@ jobs: - powershell.sh steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 # the name input parameter is not provided, so all artifacts will be downloaded - name: Load images run: | diff --git a/ci/docker/psql.sh b/ci/docker/psql.sh index b0f1b84..d422dbc 100755 --- a/ci/docker/psql.sh +++ b/ci/docker/psql.sh @@ -3,4 +3,9 @@ I="-it " if [[ "$*" == *"-c"* ]]; then I="" fi -docker exec $I -e PGCONNECT_TIMEOUT=30 docker_postgres_1 psql -U nivlheim -h localhost -d nivlheim "$@" +EXECUTABLE=docker +if ! type docker >/dev/null 2>&1; then + EXECUTABLE=podman +fi +CONTAINER_NAME=$($EXECUTABLE ps --filter ancestor=postgres --format '{{.Names}}') +$EXECUTABLE exec $I -e PGCONNECT_TIMEOUT=30 $CONTAINER_NAME psql -U nivlheim -h localhost -d nivlheim "$@"