I want to configure the gitlab pipeline to run my integration tests against a Postgres DB using Maven. I tried following this documentation but afterwards I noticed that this works only with the shared gitlab runners but I am using my own gitlab runner which runs in Kubernetes.
My gitlab-ci.yml:
cache:
key: "$CI_COMMIT_REF_NAME"
untracked: true
paths:
- .m2/repository/
variables:
MAVEN_CLI_OPTS: "-s .m2/settings.xml "
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository/"
POSTGRES_DB: postgres
POSTGRES_USER: runner
POSTGRES_PASSWORD: runner
stages:
- build
- verify
build:
image: maven:3.6.0-jdk-8
stage: build
script:
- "mvn $MAVEN_CLI_OPTS --quiet clean package -Dmaven.test.skip=true"
artifacts:
paths:
- "target/*"
test:
image: maven:3.6.0-jdk-8
services:
- postgres:latest
stage: verify
script:
- "mvn $MAVEN_CLI_OPTS --quiet -Dspring.profiles.active=dev clean test"
Using a shared runner this configuration works fine, but I have to use the runner from Kubernetes. Is there any way to execute my tests against a postgres DB without using the shared runner?