From 8c9ffb50ceeb54352aa364b475af43d806bc656f Mon Sep 17 00:00:00 2001 From: GSRN Date: Mon, 15 Sep 2025 17:16:13 +0200 Subject: [PATCH] fix: Resolve mvn command not found error in CI workflow - Replace 'mvn' commands with './mvnw' in CI workflow - Add chmod +x ./mvnw step to make Maven wrapper executable - Add cache: maven to Java setup step for better caching - Update troubleshooting scripts to use correct port 40047 - Update documentation to reflect port change This fixes the 'mvn: command not found' error by ensuring all Maven commands use the Maven wrapper (mvnw) which is included in the project and doesn't require Maven to be pre-installed on the runner. --- .gitea/workflows/ci.yml | 10 +++++++--- docs/CACHE_TROUBLESHOOTING.md | 4 ++-- runners/fix-cache-issues.ps1 | 6 +++--- runners/fix-cache-issues.sh | 6 +++--- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 5b12098..f0de7d6 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -27,6 +27,10 @@ jobs: with: java-version: '17' distribution: 'temurin' + cache: maven + + - name: Make Maven wrapper executable + run: chmod +x ./mvnw - name: Cache Maven dependencies uses: actions/cache@v4 @@ -37,13 +41,13 @@ jobs: fail-on-cache-miss: false - name: Run tests - run: mvn test + run: ./mvnw test - name: Run code quality checks - run: mvn spotbugs:check checkstyle:check + run: ./mvnw spotbugs:check checkstyle:check - name: Build application - run: mvn clean package -DskipTests + run: ./mvnw clean package -DskipTests - name: Build Docker image (test only) run: docker build -t api-gateway:test . diff --git a/docs/CACHE_TROUBLESHOOTING.md b/docs/CACHE_TROUBLESHOOTING.md index eaf2b37..077ac41 100644 --- a/docs/CACHE_TROUBLESHOOTING.md +++ b/docs/CACHE_TROUBLESHOOTING.md @@ -33,7 +33,7 @@ This ensures that cache failures don't cause the entire pipeline to fail. Updated all existing runner configuration files with: - **Auto-detect Host**: Empty host field (allows act_runner to auto-detect the correct IP) -- **Fixed Port**: `44029` (instead of random port 0) +- **Fixed Port**: `40047` (instead of random port 0) - **Host Network**: Uses host networking for better connectivity Updated files: @@ -92,7 +92,7 @@ Update your runner configuration with these key changes: cache: enabled: true host: "" # Auto-detect host IP - port: 44029 # Fixed port + port: 40047 # Fixed port container: network: "host" # Use host networking diff --git a/runners/fix-cache-issues.ps1 b/runners/fix-cache-issues.ps1 index 7c9a1cc..9b29a91 100644 --- a/runners/fix-cache-issues.ps1 +++ b/runners/fix-cache-issues.ps1 @@ -109,8 +109,8 @@ function Fix-CacheIssues { $hostIP = Get-HostIP # Set proper environment variables - $env:ACTIONS_CACHE_URL = "http://${hostIP}:44029/" - $env:ACTIONS_RUNTIME_URL = "http://${hostIP}:44029/" + $env:ACTIONS_CACHE_URL = "http://${hostIP}:40047/" + $env:ACTIONS_RUNTIME_URL = "http://${hostIP}:40047/" Write-Host "✅ Cache directory created and configured" -ForegroundColor Green Write-Host "✅ Environment variables set with host IP: $hostIP" -ForegroundColor Green @@ -163,7 +163,7 @@ function Test-CacheFunctionality { # Try to test cache service (this will fail but we can check the error) Write-Host " Testing cache service response..." -ForegroundColor Gray try { - $response = Invoke-WebRequest -Uri "http://host.docker.internal:44029/cache/$testKey" -TimeoutSec 5 -ErrorAction SilentlyContinue + $response = Invoke-WebRequest -Uri "http://${hostIP}:40047/cache/$testKey" -TimeoutSec 5 -ErrorAction SilentlyContinue Write-Host "✅ Cache service responding" -ForegroundColor Green } catch { Write-Host "❌ Cache service not responding: $($_.Exception.Message)" -ForegroundColor Yellow diff --git a/runners/fix-cache-issues.sh b/runners/fix-cache-issues.sh index 62589d2..75d02b8 100644 --- a/runners/fix-cache-issues.sh +++ b/runners/fix-cache-issues.sh @@ -104,8 +104,8 @@ fix_cache_issues() { HOST_IP=$(detect_host_ip) # Set proper environment variables - export ACTIONS_CACHE_URL="http://${HOST_IP}:44029/" - export ACTIONS_RUNTIME_URL="http://${HOST_IP}:44029/" + export ACTIONS_CACHE_URL="http://${HOST_IP}:40047/" + export ACTIONS_RUNTIME_URL="http://${HOST_IP}:40047/" echo "✅ Cache directory created and configured" echo "✅ Environment variables set with host IP: $HOST_IP" @@ -154,7 +154,7 @@ test_cache() { # Try to restore (this will fail but we can check the error) echo " Testing cache restore..." - if curl -s "http://host.docker.internal:44029/cache/$TEST_KEY" > /dev/null 2>&1; then + if curl -s "http://${HOST_IP}:40047/cache/$TEST_KEY" > /dev/null 2>&1; then echo "✅ Cache service responding" else echo "❌ Cache service not responding"