I have a few stages. What I am attempting to do is to have the pip packages installed in one staged and then used in another. This is apparently not working as when I get to the python build script it states that the package is not there.
stages:
- seccheck
- sonar
- dependencies
- python
sonarcloud-check:
stage: sonar
image:
name: sonarsource/sonar-scanner-cli:latest
entrypoint:
- ''
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"
GIT_DEPTH: '0'
cache:
key: "${CI_JOB_NAME}"
paths:
- ".sonar/cache"
script:
- export SONAR_TOKEN=$SONAR_TOKEN
- echo $SONAR_TOKEN
- sonar-scanner -X -Dsonar.organization=mikes-development -Dsonar.projectKey=mikes-development_marylanddata
-Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io
requirements:
stage: dependencies
image: python:3.12
needs:
- sonarcloud-check
cache:
paths:
- ".cache/pip"
- "./venv/lib/python3.12/site-packages"
before_script:
- python --version
- pip --version
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
script:
- pip install --upgrade pip
- pip install -r python/covid/requirements.txt
- pip install -r test/requirements.txt
- pip show pandas
python_builds:
stage: python
image: python:3.12
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
needs:
- requirements
cache:
paths:
- ".cache/pip"
before_script:
- echo "authtoken='$applicationtoken'" > python/covid/auth.py
- echo "authtoken='$applicationtoken'" > python/auth.py
# - echo "authtoken='$applicationtoken'" > python/poweroutages/auth.py
# - echo "dbuser='$dbuser'" > python/poweroutages/auth.py
# - echo "dbauth='$dbauth'" > python/poweroutages/auth.py
# - echo "dbhost='$dbhost'" > python/poweroutages/auth.py
# - echo "db='$db'" > python/poweroutages/auth.py
- apt update && apt upgrade -y
- apt-get install mlocate -y
- updatedb
script:
# - python python/covid/casesbycounty.py
# - python python/highwaysigns/highwaysigns.py
#- python python/poweroutages/poweroutages.py
- python python/test.py
- python test/test.py
artifacts:
name: output
expire_in: 7 days
paths:
- output/*.png
- output/*.csv
- ./*.png
sast:
variables:
SEARCH_MAX_DEPTH: '20'
stage: seccheck
include:
- template: Security/SAST.gitlab-ci.yml