Skip to content

Commit

Permalink
add print statement for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare committed Jan 27, 2024
1 parent 860d3db commit d875cfa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
7 changes: 3 additions & 4 deletions .github/actions/setup-postgres-linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ runs:
steps:

- name: Start the postgres service
run: |
sudo systemctl start postgresql.service
pg_isready
run: sudo systemctl start postgresql.service
shell: bash

- name: Configure the database
run: sudo -u postgres bash ./.github/scripts/setup_postgres_linux.sh
run: sudo -u postgres bash setup_postgres_linux.sh
shell: bash
working-directory: ./.github/scripts
20 changes: 2 additions & 18 deletions .github/scripts/setup_postgres_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,6 @@ PGPORT="${PGPORT:-5432}"
export PGPORT
PGHOST="${PGHOST:-localhost}"

function connect_circle() {
# try to handle circleci/docker oddness
let rc=1
while [[ $rc -eq 1 ]]; do
nc -z ${PGHOST} ${PGPORT}
let rc=$?
done
if [[ $rc -ne 0 ]]; then
echo "Fatal: Could not connect to $PGHOST"
exit 1
fi
}

# appveyor doesn't have 'nc', but it also doesn't have these issues
if [[ -n $CIRCLECI ]]; then
connect_circle
fi

for i in {1..10}; do
if pg_isready -h "${PGHOST}" -p "${PGPORT}" -U "${PGUSER}" ; then
break
Expand All @@ -38,6 +20,8 @@ for i in {1..10}; do
sleep 2;
done;

echo "Postgres is running"

createdb dbt
psql -c "CREATE ROLE root WITH PASSWORD 'password';"
psql -c "ALTER ROLE root WITH LOGIN;"
Expand Down

0 comments on commit d875cfa

Please sign in to comment.