Postgres host error while trying to run build on GitLab CI

Finally solved the issue. All I had to do was, add the postgres under the services. The documentation made it seem like the postgres service would be already there.

Here’s how my final .gilab-ci.yml looks -

services:
    - postgres

test:
    script:
        - apt-get update -y
        - apt-get install -y python-dev python-pip
        - pip install -r requirements.txt
        - python manage.py test

variables:
    DATABASE_HOST: postgres
    DATABASE_USER: postgres
    DATABASE_PASSWORD: ""