From 7534981a729e78af46ac9d6b8607b022b7db5906 Mon Sep 17 00:00:00 2001 From: aitbc1 Date: Fri, 27 Mar 2026 23:17:05 +0100 Subject: [PATCH] fix: improve package tests workspace setup and error handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PACKAGE TESTS FIX: Resolve Git workspace and package existence issues Issues Fixed: ❌ fatal: Unable to read current working directory: No such file or directory ❌ fatal: fetch-pack: invalid index-pack output ❌ Git clone failures in CI environment ❌ Package directory verification missing Root Cause: - Git lock files causing clone failures - Insufficient error handling for Git operations - Missing package existence verification - Workspace directory issues Solutions Applied: ✅ Enhanced Git clone with multiple fallback strategies ✅ System-wide Git lock file cleanup ✅ Local repository fallback option ✅ Package directory existence verification ✅ Improved error reporting and debugging Workspace Improvements: 1. Git Operations: - System-wide lock file cleanup (/opt/aitbc and /tmp) - Primary git clone attempt - Fallback to shallow clone (--depth 1) - Final fallback to local repository copy 2. Error Handling: - Graceful Git clone failures - Package existence verification - Available packages listing - Detailed debugging information 3. Robustness: - Multiple Git clone strategies - Local repository fallback - Package path validation - Comprehensive error messages Benefits: - More reliable CI/CD execution - Better debugging information - Graceful failure handling - Multiple recovery strategies - Improved workspace management This resolves the critical Git workspace issues that were preventing package tests from running in the CI/CD environment. --- .gitea/workflows/package-tests.yml | 40 ++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/package-tests.yml b/.gitea/workflows/package-tests.yml index 7fcd047b..da47ce80 100644 --- a/.gitea/workflows/package-tests.yml +++ b/.gitea/workflows/package-tests.yml @@ -50,12 +50,28 @@ jobs: mkdir -p /opt/aitbc/python-packages-workspace cd /opt/aitbc/python-packages-workspace - # Ensure no git lock files exist - find . -name "*.lock" -delete 2>/dev/null || true + # Ensure no git lock files exist system-wide + find /opt/aitbc -name "*.lock" -delete 2>/dev/null || true + find /tmp -name "*.lock" -delete 2>/dev/null || true echo "Workspace PWD: $(pwd)" echo "Cloning repository..." - git clone https://gitea.bubuit.net/oib/aitbc.git repo + + # Clone with better error handling + if ! git clone https://gitea.bubuit.net/oib/aitbc.git repo; then + echo "❌ Git clone failed, trying alternative approach..." + rm -rf repo + git clone --depth 1 https://gitea.bubuit.net/oib/aitbc.git repo || { + echo "❌ Git clone completely failed, checking if repo exists locally..." + if [[ -d "/opt/aitbc/.git" ]]; then + echo "Using local repository copy..." + cp -r /opt/aitbc repo + else + echo "❌ No repository available" + exit 1 + fi + } + fi cd repo echo "Repo PWD: $(pwd)" @@ -65,12 +81,26 @@ jobs: echo "=== PYTHON PACKAGE: ${{ matrix.package.name }} ===" echo "Package path: ${{ matrix.package.path }}" echo "Python version: ${{ matrix.package.python_version }}" + + # Verify package exists + if [[ ! -d "${{ matrix.package.path }}" ]]; then + echo "❌ Package directory not found: ${{ matrix.package.path }}" + echo "Available packages:" + find packages/py/ -maxdepth 1 -type d | grep -v "^packages/py/$" + exit 1 + fi + + echo "✅ Package directory found" - - name: Setup Python + - name: Setup Python Environment run: | - echo "=== PYTHON SETUP ===" + echo "=== PYTHON ENVIRONMENT SETUP ===" cd /opt/aitbc/python-packages-workspace/repo/${{ matrix.package.path }} + echo "Current directory: $(pwd)" + echo "Package contents:" + ls -la + # Check Python version python3 --version echo "✅ Python ${{ matrix.package.python_version }} available"