fix: gen-migrations workflow
Some checks failed
gen-migrations / gen-migrations (push) Failing after 8s

This commit is contained in:
Orion Kindel 2023-07-19 18:46:33 -05:00
parent e8e69d4790
commit 9929ee928a
Signed by untrusted user who does not match committer: orion
GPG Key ID: 6D4165AE4C928719
4 changed files with 17 additions and 9 deletions

View File

@ -7,7 +7,9 @@ jobs:
!startsWith(gitea.event.head_commit.message, 'chore')
container:
image: 'git.orionkindel.com/dnim/db-ci-runner:disheveled-iceberg-launched-loosely'
volumes: ['/run/user/1001/docker.sock:/run/user/1001/docker.sock']
volumes:
- '/run/user/1001/docker.sock:/run/user/1001/docker.sock'
- '/var/run/postgresql:/var/run/postgresql'
steps:
- uses: 'actions/checkout@v3'
with: { fetch-depth: 0, ref: 'main', submodules: 'recursive' }
@ -39,5 +41,6 @@ jobs:
git push
fi
env:
DOCKER_NETWORK_HOST: 'host.docker.internal'
PG_HOST_BASE: '/var/run/postgresql/.s.PGSQL.5432'
PG_HOST_HEAD: '/var/run/postgresql/.s.PGSQL.5433'
DOCKER_HOST: 'unix:///run/user/1001/docker.sock' # HACK: rootless docker on gitea action runner

View File

@ -6,11 +6,13 @@ services:
network_mode: 'host'
image: 'postgres:15.3-bullseye'
env_file: ['./.env.schema']
command: '-p 5432'
volumes: ['/var/run/postgresql:/var/run/postgresql']
command: '-h localhost -p 5432'
head:
container_name: 'head'
network_mode: 'host'
image: 'postgres:15.3-bullseye'
restart: 'always'
env_file: ['./.env.schema']
command: '-p 5433'
volumes: ['/var/run/postgresql:/var/run/postgresql']
command: '-h localhost -p 5433'

View File

@ -10,15 +10,16 @@ rev="$2"
if [[ "$base_or_head" = "head" ]]; then
port=5433
pg_host=${PG_HOST_HEAD:-localhost:$port}
else
port=5432
pg_host=${PG_HOST_BASE:-localhost:$port}
fi
docker compose stop "$base_or_head" 1>/dev/null
docker compose rm -f "$base_or_head" 1>/dev/null
localhost=${DOCKER_NETWORK_HOST:-localhost}
url="postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$localhost:$port"
url="postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$pg_host"
isready() {
local waited=0

View File

@ -14,9 +14,11 @@ fi;
migration="./migrations/${base}_to_${head}.sql"
localhost=${DOCKER_NETWORK_HOST:-localhost}
base_url="postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$localhost:5432/dnim"
head_url="postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$localhost:5433/dnim"
pg_host_base=${PG_HOST_BASE:-localhost:5432}
pg_host_head=${PG_HOST_HEAD:-localhost:5433}
base_url="postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$pg_host_base/dnim"
head_url="postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$pg_host_head/dnim"
if [[ -z "$base" ]] || [[ -z "$head" ]]; then
echo "revisions to diff are required ex. ./scripts/diff.sh abc bcd" 1>&2;