From 65030361cfb796a3fa8ea6d012f4daf73f4cbffa Mon Sep 17 00:00:00 2001 From: AlexeerCT Date: Thu, 2 Apr 2026 10:11:40 -0500 Subject: [PATCH] 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. --- Jenkinsfile | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0af8f6ef..ab2a87b4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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 '