Skip to content

Multiple job failures due to `psql: could not translate host name "postgres" to address: Name or service not known`

Job #1159229206 failed for 02f78e50:

$ source scripts/prepare_build.sh
Bundler version 2.1.4
$ bundle install --without=production development --jobs=2 --path=vendor --retry=3 --quiet
==> 'bundle install --without=production development --jobs=2 --path=vendor --retry=3 --quiet' succeeded in 387 seconds.
$ bundle check
The Gemfile's dependencies are satisfied
==> 'bundle check' succeeded in 1 seconds.
$ bundle pristine pg
Installing pg 1.2.3 with native extensions
==> 'bundle pristine pg' succeeded in 8 seconds.
$ setup_db_user_only
psql: could not translate host name "postgres" to address: Name or service not known
Uploading artifacts for failed job
00:02
Uploading artifacts...
WARNING: coverage-frontend/: no matching files     
WARNING: junit_jest.xml: no matching files         
tmp/tests/frontend/: found 168 matching files and directories 
Uploading artifacts as "archive" to coordinator... ok  id=1159229206 responseStatus=201 Created token=wdVyZaBe
Uploading artifacts...
WARNING: junit_jest.xml: no matching files         
ERROR: No files to upload                          
Cleaning up file based variables
00:00
ERROR: Job failed: exit code 1

Very weird, it’s as if getent hosts postgres returns true, while it should return false, leading to setup_db_user_only being called…