Refactor Jenkinsfile to dynamically locate the repository root for backend dependencies. Improved error handling for missing requirements files and updated the installation commands to reflect the new directory structure.

This commit is contained in:
2026-04-02 10:11:40 -05:00
parent 8d04a945b0
commit 65030361cf

31
Jenkinsfile vendored
View File

@@ -94,17 +94,30 @@ pipeline {
set -euxo pipefail
python --version
python -m pip install --upgrade pip
if [ -f /workspace/backend/requirements.txt ]; then
pip install -r /workspace/backend/requirements.txt
elif [ -f /workspace/backend/requirements/base.txt ]; then
pip install -r /workspace/backend/requirements/base.txt
else
echo "ERROR: No requirements file found in /workspace/backend"
ls -la /workspace/backend || true
ls -la /workspace/backend/requirements || true
REPO_ROOT=""
for d in /workspace /workspace/*; do
if [ -d "$d/backend" ]; then
REPO_ROOT="$d"
break
fi
done
if [ -z "$REPO_ROOT" ]; then
echo "ERROR: Could not locate repository root containing backend/ directory"
ls -la /workspace || true
exit 1
fi
cd /workspace/backend
echo "Detected REPO_ROOT=$REPO_ROOT"
if [ -f "$REPO_ROOT/backend/requirements.txt" ]; then
pip install -r "$REPO_ROOT/backend/requirements.txt"
elif [ -f "$REPO_ROOT/backend/requirements/base.txt" ]; then
pip install -r "$REPO_ROOT/backend/requirements/base.txt"
else
echo "ERROR: No requirements file found in $REPO_ROOT/backend"
ls -la "$REPO_ROOT/backend" || true
ls -la "$REPO_ROOT/backend/requirements" || true
exit 1
fi
cd "$REPO_ROOT/backend"
alembic upgrade head
pytest -q tests -v -ra -s
'