Tox install package from private gitlab repository

Viewed 35

i'm running test using tox in a ci/cd pipeline on a self-hosted instance of gitlab. I developed a custom package which in setup.py install some dependencies listed in a requirements.txt. Alongside this dependencies, there are another custom package i developed. My ci/cd file

stages:
  - check



before_script:
    # here you can run any commands before the pipelines start
    - apt-get -qq update && apt-get -qq install -y python3.9
    - apt-get install -y libpq-dev &&  apt-get install -y python3.9-dev
    - apt-get install -y build-essential && apt-get install -y gcc && apt-get install -y postgresql
    - apt-get install -y  postgresql-contrib && apt-get install -y  ffmpeg libsm6 libxext6
    - pip install tox

check:
  stage: check
  image: gitlabds.xxxx.com:5050/xxxxx/buildimage:latest
  environment: prod
  services:
    - name: docker:19.03.8-dind #20.10.7
      alias: docker
  only:
    - master
  script:
    - tox

Tox.ini

[tox]
envlist =
    {python3.9}


[testenv]
passenv = *
setenv =
    variable i need
deps=
    pytest
    -rrequirements.txt
commands=
    pytest

requirements.txt:

certifi==2020.6.20
chardet==3.0.4
curlify==2.2.1
facebook-business==13.0.0
facebookads==2.11.4
idna==2.10
mock==4.0.2
numpy==1.19.0
pandas==1.4.2
psycopg2==2.9.3
pycountry==20.7.3
python-dateutil==2.8.1
pytz==2020.1
requests==2.24.0
six==1.15.0
urllib3==1.25.10
emoji==0.6.0
vertica-python==0.8.0
pip==20.2
PyYAML==5.3.1
proto-plus==1.19.6
MarkupSafe==1.1.1
joblib==0.16.0
Jinja2==2.11.2
six==1.15.0
jinjasql==0.1.8
multiprocessing_logging==0.3.1
google-ads==15.1.1
loguru==0.5.3
python-facebook-api-custom @ git+https://gitlabds.xxxxx.com/datascience/python-facebook-custom.git

When running tox says

Running command git clone --filter=blob:none --quiet https://xxxxx.esprinet.com/xxxx/python-facebook-custom.git

/tmp/pip-install-ty2wx7xj/python-facebook-api_9324e2e7179542a882e9b65b22d401c4 fatal: could not read Username for 'https://gitlabds.esprinet.com': No such device or address

Basically he can't find username and password to clone the git repo. I can't delete the custom package installation in requirements.txt since otherwise my custom package won't be installed and i need it to run some tests.

Do i need to pass ( safely or not) username and password in the ci/cd as variable? Where those variable should be put and how they should be named?

Thanks

0 Answers
Related