Today I made progress on running CI in GitLab. Here’s the branch:
The current situation is that tests run as root in the docker container, but
pg_ctl says “cannot be run as root”.
In other words, the scripts assume the user is unprivileged, but the docker
image (and the GitLab runner) assume the user is root.
I tried to to just set up the database with ‘sudo -u postgres’, but (a) the
postgres user is arbitrary here, and perhaps misleading, (b) the database still
can’t be accessed as root. “No such role” is the connection error.
I would need to invasively modify some scripts to work around (b), and I think
it might be better to just set up an actual database instead. But the scripts
are dead set on using a directory-local database cluster, so that would need to
I tried to use a USER command in the Dockerfile to switch to an unprivileged
user. That seems like a promising avenue, but by default the GitLab runner is
trying to put files in privileged places (/build) and they aren’t accessible by
unprivileged users. At least, I think that’s what is happening. See error
message here: test-build (#340419246) · Jobs · Snowdrift.coop / snowdrift · GitLab .
Haven’t done this yet, but perhaps the best idea is to just set up an actual
database (we could use GitLab CI services, even). This is
probably already pretty well supported - the CI scripts just need to stop
setting up the local-directory cluster and use the PG environment variables.
Feel free to pick up this task - I won’t have time to look at it again for a