Postgresql service doesn't startup normally

Summary

Postgresql container throws an error because the superuser password is not specified

Steps to reproduce

.gitlab-ci.yml
image: "ruby:2.6.5"

services:
  - postgres:11
  - redis

Actual behavior

The PostgreSQL service doesn't start

Expected behavior

The PostgreSQL service should run normally

Relevant logs and/or screenshots

job log
*** WARNING: Service ***-postgres-0 probably didn't start properly.
 Health check error:
 ContainerStart: Error response from daemon: Cannot link to a non running container: /runner-***-postgres-0 AS /runner-***-postgres-0-wait-for-service/service (executor_docker.go:1259:0s)
 Service container logs:
 2020-02-17T14:50:07.373452975Z Error: Database is uninitialized and superuser password is not specified.
 2020-02-17T14:50:07.373496286Z        You must specify POSTGRES_PASSWORD for the superuser. Use
 2020-02-17T14:50:07.373500818Z        "-e POSTGRES_PASSWORD=password" to set it in "docker run".
 2020-02-17T14:50:07.373504253Z 
 2020-02-17T14:50:07.373507180Z        You may also use POSTGRES_HOST_AUTH_METHOD=trust to allow all connections
 2020-02-17T14:50:07.373510364Z        without a password. This is *not* recommended. See PostgreSQL
 2020-02-17T14:50:07.373513511Z        documentation about "trust":
 2020-02-17T14:50:07.373516497Z        https://www.postgresql.org/docs/current/auth-trust.html
 *********

Environment description

config.toml contents
Add your configuration here

Used GitLab Runner version

Fix

There is nothing that the Runner can do to solve this problem. The user has to update their .gitlab-ci.yml to either the following:

Rollback

Use a specific image for the service for example postgres:11-alpine which doesn't require you to set a POSTGRES_PASSWORD for the service to start.

Set DB password

Update your .gitlab-ci.yml and test to use the password:

services:
  - postgres:latest

variables:
  POSTGRES_DB: nice_marmot
  POSTGRES_USER: runner
  POSTGRES_PASSWORD: "runner-password"
  POSTGRES_HOST_AUTH_METHOD: trust

This is shown in our official example

Edited by Steve Xuereb