From f52d2902b20561ae146df8b1fe53b09422b60fee Mon Sep 17 00:00:00 2001 From: chrislu Date: Sun, 23 Nov 2025 11:07:05 -0800 Subject: [PATCH] fix: copy Maven artifacts into workspace instead of mounting $HOME/.m2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: Docker volume mount from $HOME/.m2 wasn't working in GitHub Actions - Container couldn't access the locally built SNAPSHOT JARs - Maven failed with 'Could not find artifact seaweedfs-hadoop3-client:3.80.1-SNAPSHOT' Solution: Copy Maven repository into workspace 1. In CI: Copy ~/.m2/repository/com/seaweedfs to test/java/spark/.m2/repository/com/ 2. docker-compose.yml: Mount ./.m2 (relative path in workspace) 3. .gitignore: Added .m2/ to ignore copied artifacts Why this works: - Workspace directory (.) is successfully mounted as /workspace - ./.m2 is inside workspace, so it gets mounted too - Container sees artifacts at /root/.m2/repository/com/seaweedfs/... - Maven finds the 3.80.1-SNAPSHOT JARs with our debug logging! Next run should finally show the [DEBUG-2024] logs! 🎯 --- .github/workflows/spark-integration-tests.yml | 16 ++++++++++------ test/java/spark/.gitignore | 1 + test/java/spark/docker-compose.yml | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/spark-integration-tests.yml b/.github/workflows/spark-integration-tests.yml index aa570e4d3..265b8cca0 100644 --- a/.github/workflows/spark-integration-tests.yml +++ b/.github/workflows/spark-integration-tests.yml @@ -199,14 +199,18 @@ jobs: curl -s http://localhost:9333/dir/status | jq '.' || echo "jq not available" echo "✓ Volume server registered, volumes will be created on-demand during tests" - - name: Verify Maven artifacts before tests + - name: Prepare Maven repository for Docker + working-directory: test/java/spark run: | - echo "Verifying Maven artifacts are available in ~/.m2/repository..." - echo "Checking for SNAPSHOT artifacts:" - find ~/.m2/repository/com/seaweedfs -name "*3.80.1-SNAPSHOT*" 2>/dev/null | sort || echo "No SNAPSHOT artifacts found!" + echo "Copying Maven artifacts into workspace for Docker access..." + mkdir -p .m2/repository/com + cp -r ~/.m2/repository/com/seaweedfs .m2/repository/com/ + + echo "Verifying copied artifacts:" + find .m2/repository/com/seaweedfs -name "*3.80.1-SNAPSHOT*" | sort echo "" - echo "All seaweedfs JARs:" - find ~/.m2/repository/com/seaweedfs -name "*.jar" 2>/dev/null | sort + echo "Directory size:" + du -sh .m2/repository/com/seaweedfs - name: Run Spark integration tests in Docker working-directory: test/java/spark diff --git a/test/java/spark/.gitignore b/test/java/spark/.gitignore index 27164dbd2..62341354a 100644 --- a/test/java/spark/.gitignore +++ b/test/java/spark/.gitignore @@ -1,5 +1,6 @@ # Maven target/ +.m2/ pom.xml.tag pom.xml.releaseBackup pom.xml.versionsBackup diff --git a/test/java/spark/docker-compose.yml b/test/java/spark/docker-compose.yml index 4588a0720..0069e94b6 100644 --- a/test/java/spark/docker-compose.yml +++ b/test/java/spark/docker-compose.yml @@ -71,7 +71,7 @@ services: container_name: seaweedfs-spark-tests volumes: - .:/workspace - - ${HOME}/.m2:/root/.m2 + - ./.m2:/root/.m2 working_dir: /workspace environment: - SEAWEEDFS_TEST_ENABLED=true