Reputation: 1509
I'm struggling to get a Gitlab CI up and running that uses the correct version of postgres (13) and has PGTap installed.
I deploy my project locally using a Dockerfile which uses postgres:13.3-alpine
and then installs PGTap too. However, I'm not sure if I can use this Dockerfile to help with my CI issues.
In my gitlab-ci.yml file, I currently have:
variables:
GIT_SUBMODULE_STRATEGY: recursive
pgtap:
only:
refs:
- merge_request
- master
changes:
- ddl/**/*
image: postgres:13.1-alpine
services:
- name: postgres:13.1-alpine
alias: db
variables:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: trust
script:
- psql postgres://postgres@db/postgres -c 'create extension pgtap;'
- psql postgres://postgres@db/postgres -f ddl/01.sql
- cd ddl/
- psql postgres://postgres@db/postgres -f 02.sql
- psql postgres://postgres@db/postgres -f 03.sql
- pg_prove -d postgres://postgres@db/postgres --recurse test_*
The above works until it gets to the pg_prove
command at the bottom as I get the below error:
pg_prove: command not found
Is there a way I can install pg_prove using the script commands? Or is there a better way to do this?
Upvotes: 0
Views: 451
Reputation: 8520
Since your step image is alpine based, you can try:
script:
- apk add --no-cache --update build-base make perl perl-dev git openssl-dev
- cpan TAP::Parser::SourceHandler::pgTAP
- psql.. etc
You can probably omit some of the packages...
Upvotes: 0
Reputation: 6269
There is an old issue closed.
To summarize, either you build you own image based on postgres:13.1-alpine
installing PGTap or you use a non official image where PGTap is installed 1maa/postgres:13-alpine
:
docker run -it 1maa/postgres:13-alpine sh
/ # which pg_prove
/usr/local/bin/pg_prove
Upvotes: 1