3

Setting up Continuous Integration on Gitlab with the below yaml

default:
  image: centos:centos8

stages:
  - build
  - test
  - staging
  - production

variables:
  POSTGRES_DB: $PROJECT_DB_NAME
  POSTGRES_USER: $PROJECT_DB_USER
  POSTGRES_PASSWORD: $PROJECT_DB_USER_PASSWORD
  POSTGRES_HOST_AUTH_METHOD: $POSTGRES_HOST_AUTH

services:
  - postgres:12.2-alpine

env_setup:
  stage: build
  script:
    - yum update -y
    - yum -y install epel-release
    - yum -y groupinstall "Development Tools"

    - yum install python3-devel -y && yum install wget -y
    - dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
    - dnf config-manager --set-enabled PowerTools
    - dnf install dnf-plugins-core

    # install proj6 ( needed by gdal )
    - wget https://download.osgeo.org/proj/proj-6.0.0.tar.gz
    - tar xf proj-6.0.0.tar.gz && cd proj-6.0.0/
    - ./configure && make install

    # install gdal
    - wget http://download.osgeo.org/gdal/3.0.2/gdal-3.0.2.tar.gz
    - tar xf gdal-3.0.2.tar.gz && cd gdal-3.0.2/
    - ./configure --with-proj=/usr/local && make install

    # set GDAL intallation path to current working directory
    - export GDAL_LIBRARY_PATH=`pwd`

    # install gdal-devel
    - yum install gdal-devel -y
    - echo $GDAL_LIBRARY_PATH             # outputs GDAL_LIBRARY_PATH SET ABOVE
    - echo "Hello World"

app_test:
  stage: test
  image: python:latest
  script:
    - pip install -r requirements.txt
    - python manage.py test --settings=apimvp.settings.dev_settings

Job env_setup runs fine - meaning proj6 library needed by GDAL and GDAL library gets successfully installed.

But each time i commit I get this error

django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal", "GDAL", "gdal3.1.0", "gdal3.0.0", "gdal2.4.0", "gdal2.3.0", "gdal2.2.0", "gdal2.1.0", "gdal2.0.0"). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings

What am I doing wrong

spaceofmiah
  • 238
  • 2
  • 17

1 Answers1

0

The GDAL_LIBRARY_PATH should be in you Django settings.py file

like this :

GDAL_LIBRARY_PATH=r"/the/path/of/gdal"