Error runner on Kubernetes managed cluster with no POSTGRESS_PASSWORD superuser
Since some days I'm experiencing problems running Gitlab CI runners on a managed Kubernetes. We used to be able to run the tests without setting a password but now it's required.
Looking at the logs of Kubernetes we can find why it's not running
Error: Database is uninitialized and superuser password is not specified. You must specify POSTGRES_PASSWORD for the superuser. Use "-e POSTGRES_PASSWORD=password" to set it in "docker run".
You may also use POSTGRES_HOST_AUTH_METHOD=trust to allow all connections without a password. This is not recommended. See PostgreSQL documentation about "trust": https://www.postgresql.org/docs/current/auth-trust.html
Setting a password for the superuser or adding POSTGRES_HOST_AUTH_METHOD=trust to the enviroment makes it run correctly.
Question is: did something changed in the GitLab CI managed kubernetes or did something change in Postgres that got this errror message?
Here the complete .gitlab-ci.yml that fails.
image: alpine:latest
variables:
DOCKER_DRIVER: overlay2
cache:
paths:
- vendor/ruby
- node_modules
key: web-cache
before_script: &default
- ruby -v
- which ruby
- gem install bundler
- bundle install -j $(nproc) --path vendor
rspec:
image: ruby:2.6.5
before_script:
- apt-get update -qq && apt-get install apt-transport-https ca-certificates libnss3 -y
- curl -sL https://deb.nodesource.com/setup_12.x | bash -
- curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
- echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
- apt-get update -qq && apt-get install nodejs yarn -y
- ruby -v
- which ruby
- gem install bundler
- bundle install -j $(nproc) --path vendor
- yarn install
script:
- bundle exec rails db:test:prepare
- bundle exec rspec
artifacts:
when: on_failure
expire_in: 1 week
paths:
- tmp/screenshots/
- log/
services:
- postgres:latest
- redis:latest
- selenium/standalone-chrome-debug:latest
variables:
POSTGRES_HOST: localhost
POSTGRES_DB: test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ""
REDIS_SERVER: redis://localhost:6379/0
SELENIUM_URL: http://localhost:4444/wd/hub
DOCKER_COMPOSE: 'true'
rubocop:
image: ruby:2.6.5
script:
- bundle exec rubocop
brakeman:
image: ruby:2.6.5
script:
- bundle exec brakeman