Skip to content

Commit

Permalink
fix(ci): Address some plumbing issues
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 112a14e
Author: Rafael Espinoza <rafael@rafaelespinoza.com>
Date:   Sun Sep 24 14:00:56 2023 -0700

    fix(ci): Ensure running container so that cp_coverage_to_host works

commit aca9b17
Author: Rafael Espinoza <rafael@rafaelespinoza.com>
Date:   Sun Sep 24 12:44:43 2023 -0700

    fix(ci/postgres): Allow client to connect to server

    Something must have changed in recent base images for postgres server.
    Previously, there weren't any issues connecting to DB. But now have this
    error message from the server:
      no pg_hba.conf entry for host "172.18.0.3", user "godfish", database "godfish_test", no encryption

    Ensure that this test DB is connectable.
  • Loading branch information
rafaelespinoza committed Sep 24, 2023
1 parent 242722e commit ae2f913
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .ci/cp_coverage_to_host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,24 @@ set -eu

docker_compose_filename="${1:?missing docker_compose_filename}"

if [ ! -f "${docker_compose_filename}" ]; then
echo >&2 "no file at ${docker_compose_filename}"
exit 1
fi

echo >&2 "ensuring that client container is running..."
docker-compose -f "${docker_compose_filename}" start client

# Only needed the client container for this step, but starting one container will probably also
# start any containers that the target depended on. Should ensure that those dependee containers are
# also stopped.
trap 'docker-compose -f "${docker_compose_filename}" stop -t 5' EXIT

docker_container_id="$(docker-compose -f "${docker_compose_filename}" ps -q client)"
if [ -z "${docker_container_id}" ]; then
echo >&2 "no container id found"
exit 1
fi

docker cp "${docker_container_id}:/tmp/cover.out" /tmp
docker cp "${docker_container_id}:/tmp/cover_driver.out" /tmp
7 changes: 7 additions & 0 deletions .ci/postgres/server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,10 @@ su - postgres -c "psql -v ON_ERROR_STOP=1" <<-SQL
CREATE DATABASE ${dbname} WITH ENCODING utf8 OWNER ${dbuser};
GRANT ALL PRIVILEGES ON DATABASE ${dbname} TO ${dbuser};
SQL

if [ ! -d "${PGDATA}" ]; then
echo >&2 "directory, ${PGDATA}, does not exist"
exit 1
fi

echo "host ${dbname} ${dbuser} all trust" >> "${PGDATA}/pg_hba.conf"

0 comments on commit ae2f913

Please sign in to comment.