My gitlab ci pipeline keeps failing. It seems am stuck here. Am actually still new to the CI thing so I don't know what am doing wrong. Any help will be appreciated Below is .gitlab-ci.yml file
image: python:latest
services:
- postgres:latest
variables:
POSTGRES_DB: thorprojectdb
POSTGRES_PASSWORD: $''
POSTGRES_USER: $majesty
POSTGRES_HOST_AUTH_METHOD: trust
# This folder is cached between builds
# http://docs.gitlab.com/ee/ci/yaml/README.html#cache
cache:
paths:
- ~/.cache/pip/
before_script:
- python -V
connect:
image: postgres
script:
# official way to provide password to psql: http://www.postgresql.org/docs/9.3/static/libpq-envars.html
- export PGPASSWORD=$POSTGRES_PASSWORD
- psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "SELECT 'OK' AS status;"
build:
stage: build
script:
- pip install -r requirements.txt
- python manage.py migrate
only:
- EC-30
In my settings.py file, I have the following settings
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'projectdb',
'HOST': 'postgres',
'PASSWORD': ''
}
}
But when I push to gitlab, the build process keeps failing. The - pip install -r requirements.txt
runs perfectly but once it gets to - python manage.py migrate
, it fails. Below is the error I do get
django.db.utils.OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Cleaning up project directory and file based variables
ERROR: Job failed: exit code 1