I use gitlab-ci in my rails app, it ran correctly till yesterday but it does not pass due to:
rake aborted!
PG::ConnectionBad: could not translate host name "postgres" to address: Name does not resolve
/usr/local/bundle/gems/pg-1.1.4/lib/pg.rb:56:in `initialize'
/usr/local/bundle/gems/pg-1.1.4/lib/pg.rb:56:in `new'
/usr/local/bundle/gems/pg-1.1.4/lib/pg.rb:56:in `connect'
....
Tasks: TOP => db:schema:load => db:check_protected_environments
.gitlab-ci.yml :
rspec:
stage: test
services:
- postgres:10
variables:
DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/$POSTGRES_DB"
POSTGRES_DB: db_test
RAILS_ENV: test
before_script:
- ruby -v
script:
- cp config/application.sample.yml config/application.yml
- cp config/database.sample.yml config/database.yml
- bundle exec rake db:schema:load
- bundle exec rspec spec
It seems it can not find the postgres service running or for some reason the database service is not running correctly, I guess some internals has changed in gitlab-ci.