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:
31
Jenkinsfile
vendored
31
Jenkinsfile
vendored
@@ -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
|
||||
'
|
||||
|
||||
Reference in New Issue
Block a user