I’m new to gitlab, and even though I’m enjoying it very much, but I’ve been struggling a bit with the CI/CD.
More specifically I’ve been trying to run the following .gitlab-ci.yml, where I need a postgres container to test my Flask API, however Flask is unable to find postgres, so I’m either doing something wrong, or I’m missing the actual postgres service.
image: python:3 stages: - test flask_test: stage: test variables: FLASK_ENV: "testing" DATABASE_URL: "postgresql://postgres:postgres@postgresql:5432/structured-data-db" POSTGRES_DB: "structured-data-db" POSTGRES_PASSWORD: "postgres" services: - postgres:12.2 script: - pip3 install --no-cache-dir -r dependencies.txt - python3 manage.py db init - python3 manage.py db migrate - python3 manage.py db upgrade - coverage run -m unittest - coverage xml artifacts: reports: cobertura: coverage.xml only: - master
From what I understood from the documentation I need to add the postgres service to a runner, however the tutorials to create a runner teach how to install it on your computer. Is it possible to run the postgres service on a runner on gitlab.com, or use one of the shared runners for that purpose?