diff --git a/.gitea/workflows/cicd.yml b/.gitea/workflows/cicd.yml index 7f1b936..048b90b 100644 --- a/.gitea/workflows/cicd.yml +++ b/.gitea/workflows/cicd.yml @@ -564,8 +564,9 @@ jobs: export CI=true && export NODE_ENV=test && echo 'Verifying Playwright installation...' && - yarn playwright --version || echo 'Playwright CLI not available via yarn' && - npx playwright --version || echo 'Playwright CLI not available via npx' && + yarn playwright --version && + echo 'Installing Playwright browser binaries...' && + yarn playwright install --with-deps && echo 'Running tests via yarn script...' && yarn test:e2e --reporter=list else diff --git a/Dockerfile.cicd b/Dockerfile.cicd index a52a31c..ddae255 100644 --- a/Dockerfile.cicd +++ b/Dockerfile.cicd @@ -115,21 +115,26 @@ RUN export NODE_OPTIONS="--max-old-space-size=1024 --max-semi-space-size=64" && echo "✓ Frontend dependencies installed (leveraging global tools)"; \ fi -# Playwright browsers are pre-installed in the base image for performance -# Just verify they're available and compatible with project dependencies +# Playwright browsers optimization check (may be pre-installed in base image) RUN if [ -f ".frontend-deps-failed" ]; then \ echo "Frontend dependencies failed - Playwright E2E tests will be skipped"; \ elif grep -q '@playwright/test' package.json && [ -d "node_modules" ]; then \ - echo "Verifying Playwright browsers from base image..." && \ - # Verify global Playwright CLI is working (installed via npm globally) - playwright --version && \ - # Verify browsers are installed (they should be from base image) - playwright install --dry-run chromium firefox webkit || \ - echo "Note: Using globally installed browsers from base image" && \ - echo "✓ Playwright browsers available from base image"; \ + echo "Checking Playwright browser optimization status..." && \ + # Check if Playwright CLI is available via yarn (from project dependencies) + if yarn playwright --version >/dev/null 2>&1; then \ + echo "✓ Playwright CLI available via yarn" && \ + # Check if browsers are pre-installed from base image + if yarn playwright install --dry-run >/dev/null 2>&1; then \ + echo "✓ Playwright browsers available from base image optimization"; \ + else \ + echo "⚠ Playwright browsers not pre-installed - will install on demand in CI"; \ + fi; \ + else \ + echo "⚠ Playwright CLI not available - E2E setup will be handled in CI"; \ + fi && \ + echo "✓ Playwright environment checked"; \ else \ - echo "Playwright not found in package.json or node_modules missing"; \ - echo "E2E tests will be skipped but browsers remain available from base image"; \ + echo "ℹ No Playwright tests configured in this project"; \ fi # Verify all tools are working with the project diff --git a/docs/CICD_MULTI_STAGE_BUILD.md b/docs/CICD_MULTI_STAGE_BUILD.md index e429598..a9c092b 100644 --- a/docs/CICD_MULTI_STAGE_BUILD.md +++ b/docs/CICD_MULTI_STAGE_BUILD.md @@ -184,6 +184,40 @@ RUN export NODE_OPTIONS="--max-old-space-size=1024" && \ - **Memory Constraints**: Monitor swap usage on Raspberry Pi workers - **Network Timeouts**: Retry mechanisms handle transient failures +#### Base Image Optimization Issues + +**Missing `/opt/python-dev-tools/` (Oct 2025 Resolution)**: +- **Symptom**: Build fails with `No virtual environment or system Python installation found for path /opt/python-dev-tools/bin/python` +- **Cause**: Base image in registry doesn't contain pre-installed Python dev tools optimization +- **Fix Applied**: Made complete image resilient to missing optimization + ```dockerfile + # In Dockerfile.cicd - now handles missing pre-installed tools gracefully + if [ -f "/opt/python-dev-tools/bin/python" ]; then + echo "✓ Found pre-installed Python dev tools - leveraging cache" + else + echo "⚠ Pre-installed Python dev tools not found - fresh installation" + fi + ``` +- **Impact**: Builds continue successfully but without optimization benefits (~20s longer) +- **Long-term Solution**: Rebuild base image to restore `/opt/python-dev-tools/` optimization + +**Playwright E2E Test Failures (Oct 2025 Resolution)**: +- **Symptom**: `error: unknown option '--headed=false'` during E2E test execution +- **Cause**: Invalid Playwright CLI flag syntax in workflow and documentation +- **Fix Applied**: + - Removed invalid `--headed=false` flag (Playwright defaults to headless in CI) + - Changed to proper `yarn test:e2e --reporter=list` command + - Updated documentation with correct headless examples +- **Key Learning**: Use yarn scripts (`yarn test:e2e`) rather than direct Playwright CLI calls + +**Missing Playwright Browser Binaries (Nov 2025 Resolution)**: +- **Symptom**: `Executable doesn't exist at /root/.cache/ms-playwright/chromium_headless_shell-*/` for all browsers +- **Cause**: Base image browsers not properly cached or registry image outdated +- **Fix Applied**: Added `yarn playwright install --with-deps` step before running E2E tests in CI +- **Docker Enhancement**: Made Dockerfile.cicd more resilient to missing browser optimization +- **Impact**: E2E tests now work but download ~400MB of browsers each time (slower without base image optimization) +- **Long-term Solution**: Rebuild base image to restore Playwright browser caching + ## Migration Path ### From Single-Stage Build