More degug logs around plugin unzip #114
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Integration Test | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| test-deployment: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Generate unique test name | |
| id: test-name | |
| run: | | |
| # Create unique name with GitHub run number | |
| TEST_NAME="mautic-test-${{ github.run_number }}" | |
| echo "test-name=$TEST_NAME" >> $GITHUB_OUTPUT | |
| echo "π·οΈ Test VPS name: $TEST_NAME" | |
| - name: Deploy Mautic (Initial Installation) | |
| id: deploy | |
| uses: ./ | |
| with: | |
| vps-name: ${{ steps.test-name.outputs.test-name }} | |
| vps-size: 's-1vcpu-1gb' | |
| vps-region: 'nyc1' | |
| email: 'test@mautic-test.local' | |
| mautic-password: ${{ secrets.TEST_MAUTIC_PASSWORD }} | |
| mysql-password: ${{ secrets.TEST_MYSQL_PASSWORD }} | |
| mysql-root-password: ${{ secrets.TEST_MYSQL_ROOT_PASSWORD }} | |
| digitalocean-token: ${{ secrets.DIGITALOCEAN_TOKEN }} | |
| ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| # Start with older version for upgrade testing | |
| mautic-version: '6.0.4-apache' | |
| plugins: | | |
| https://github.com/chimpino/stripe-plugin/archive/refs/heads/6.x.zip?directory=StripePlugin&token=${{ secrets.CHIMPINO_GITHUB_TOKEN }} | |
| - name: Show initial deployment results | |
| run: | | |
| echo "π Initial deployment completed successfully!" | |
| echo "VPS IP: ${{ steps.deploy.outputs.vps-ip }}" | |
| echo "Mautic URL: ${{ steps.deploy.outputs.mautic-url }}" | |
| echo "β Mautic 6.0.4 installation test passed" | |
| - name: Verify initial deployment is ready | |
| run: | | |
| echo "π Actively verifying Mautic 6.0.4 is fully ready..." | |
| echo "π Debug: Checking deployment outputs..." | |
| echo " VPS IP: '${{ steps.deploy.outputs.vps-ip }}'" | |
| echo " Mautic URL: '${{ steps.deploy.outputs.mautic-url }}'" | |
| # Setup SSH for container verification | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
| chmod 600 ~/.ssh/id_rsa | |
| VPS_IP="${{ steps.deploy.outputs.vps-ip }}" | |
| MAUTIC_URL="${{ steps.deploy.outputs.mautic-url }}" | |
| # First verify all containers are running | |
| echo "π³ Verifying all Docker containers are running correctly..." | |
| CONTAINER_STATUS=$(ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa root@$VPS_IP "cd /var/www && docker compose ps --format 'table {{.Name}}\t{{.Status}}\t{{.Health}}'") | |
| echo "$CONTAINER_STATUS" | |
| # Check mautic_db | |
| if echo "$CONTAINER_STATUS" | grep -q "mautic_db.*Up.*healthy"; then | |
| echo "β mautic_db container is running and healthy" | |
| else | |
| echo "β mautic_db container is not healthy" | |
| ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa root@$VPS_IP "docker logs mautic_db --tail 50" | |
| exit 1 | |
| fi | |
| # Check mautic_web | |
| if echo "$CONTAINER_STATUS" | grep -q "mautic_web.*Up.*healthy"; then | |
| echo "β mautic_web container is running and healthy" | |
| else | |
| echo "β mautic_web container is not healthy" | |
| ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa root@$VPS_IP "docker logs mautic_web --tail 50" | |
| exit 1 | |
| fi | |
| # Check mautic_cron | |
| if echo "$CONTAINER_STATUS" | grep -q "mautic_cron.*Up"; then | |
| echo "β mautic_cron container is running" | |
| else | |
| echo "β mautic_cron container is not running" | |
| ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa root@$VPS_IP "docker logs mautic_cron --tail 50" | |
| exit 1 | |
| fi | |
| echo "π All expected containers are running correctly!" | |
| # Validate URL before proceeding with accessibility tests | |
| if [ -z "$MAUTIC_URL" ]; then | |
| echo "β Error: MAUTIC_URL is empty!" | |
| echo "π Deploy step outputs:" | |
| echo " - vps-ip: '${{ steps.deploy.outputs.vps-ip }}'" | |
| echo " - mautic-url: '${{ steps.deploy.outputs.mautic-url }}'" | |
| echo " - deployment-log: '${{ steps.deploy.outputs.deployment-log }}'" | |
| exit 1 | |
| fi | |
| echo "β MAUTIC_URL is set to: $MAUTIC_URL" | |
| # Wait up to 2 minutes for Mautic to be fully ready | |
| timeout=120 | |
| counter=0 | |
| while [ $counter -lt $timeout ]; do | |
| echo "β³ Testing Mautic readiness... (${counter}/${timeout}s)" | |
| # Test login page accessibility - accept both 200 and 302 as success | |
| HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" "${MAUTIC_URL}/s/login" 2>/dev/null || echo "000") | |
| echo "π HTTP response code: $HTTP_CODE" | |
| if [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "302" ]; then | |
| echo "β Mautic is responding (HTTP $HTTP_CODE)" | |
| # For 302 redirects, this is normal for fresh Mautic installations | |
| if [ "$HTTP_CODE" = "302" ]; then | |
| echo "π HTTP 302 detected - Mautic is redirecting (normal for fresh installation)" | |
| echo "β Mautic application is ready for setup!" | |
| break | |
| fi | |
| # For 200 responses, verify the page contains expected Mautic content | |
| if curl -s "${MAUTIC_URL}/s/login" | grep -q -i "mautic\|login"; then | |
| echo "β Mautic application is fully ready!" | |
| break | |
| else | |
| echo "β οΈ Page accessible but content not ready yet..." | |
| fi | |
| else | |
| echo "β οΈ Mautic not yet accessible (HTTP $HTTP_CODE)..." | |
| fi | |
| sleep 5 | |
| counter=$((counter + 5)) | |
| done | |
| if [ $counter -ge $timeout ]; then | |
| echo "β Timeout waiting for Mautic to be ready" | |
| echo "π Final check - attempting to access ${MAUTIC_URL}/s/login" | |
| curl -v "${MAUTIC_URL}/s/login" || echo "Failed to access Mautic" | |
| exit 1 | |
| fi | |
| echo "π Initial deployment verification completed - ready for upgrade test!" | |
| - name: Verify plugin installation | |
| run: | | |
| echo "π Verifying plugins were installed correctly..." | |
| VPS_IP="${{ steps.deploy.outputs.vps-ip }}" | |
| if [ -z "$VPS_IP" ]; then | |
| echo "β Error: VPS_IP is empty!" | |
| exit 1 | |
| fi | |
| # Check if the plugin directories exist and contain expected files | |
| ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa root@${VPS_IP} << 'EOF' | |
| echo "π Checking plugin directory structure..." | |
| plugin_success=0 | |
| # Check StripePlugin (private repo with token) | |
| if docker exec mautic_web ls /var/www/html/docroot/plugins/StripePlugin >/dev/null 2>&1; then | |
| echo "β StripePlugin directory found" | |
| if docker exec mautic_web find /var/www/html/docroot/plugins/StripePlugin -name "*.php" | head -1 | grep -q ".php"; then | |
| echo "β StripePlugin contains PHP files - installation successful" | |
| plugin_success=$((plugin_success + 1)) | |
| else | |
| echo "β οΈ StripePlugin directory exists but no PHP files found" | |
| echo "π Debug: Contents of StripePlugin directory:" | |
| docker exec mautic_web ls -la /var/www/html/docroot/plugins/StripePlugin/ || echo "Failed to list directory contents" | |
| echo "π Debug: Looking for any files in StripePlugin:" | |
| docker exec mautic_web find /var/www/html/docroot/plugins/StripePlugin -type f | head -10 || echo "No files found" | |
| echo "π Debug: Directory size and file count:" | |
| docker exec mautic_web bash -c 'du -sh /var/www/html/docroot/plugins/StripePlugin/ && find /var/www/html/docroot/plugins/StripePlugin -type f | wc -l' || echo "Failed to get directory info" | |
| fi | |
| else | |
| echo "β οΈ StripePlugin directory not found (check CHIMPINO_GITHUB_TOKEN secret)" | |
| fi | |
| echo "π Available plugin directories:" | |
| docker exec mautic_web ls -la /var/www/html/docroot/plugins/ || echo "No plugins directory found" | |
| if [ $plugin_success -gt 0 ]; then | |
| echo "β Plugin installation verification completed ($plugin_success plugins successful)" | |
| exit 0 | |
| else | |
| echo "β No plugins were installed successfully" | |
| exit 1 | |
| fi | |
| EOF | |
| echo "π Plugin verification completed successfully!" | |
| - name: Test plugin accessibility via Mautic | |
| run: | | |
| echo "π Testing if Mautic recognizes the installed plugins..." | |
| VPS_IP="${{ steps.deploy.outputs.vps-ip }}" | |
| # Check plugin status through Mautic console (if available) | |
| ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa root@${VPS_IP} << 'EOF' | |
| cd /var/www | |
| echo "π§ Testing Mautic plugin recognition..." | |
| # Check if plugin files are accessible from container | |
| plugin_count=0 | |
| if docker exec mautic_web ls /var/www/html/plugins/StripePlugin/ >/dev/null 2>&1; then | |
| echo "β StripePlugin files are accessible from Mautic container" | |
| plugin_count=$((plugin_count + 1)) | |
| else | |
| echo "βΉοΈ StripePlugin not accessible from container" | |
| fi | |
| if docker exec mautic_web ls /var/www/html/plugins/IntegrationsPlugin/ >/dev/null 2>&1; then | |
| echo "β IntegrationsPlugin files are accessible from Mautic container" | |
| plugin_count=$((plugin_count + 1)) | |
| else | |
| echo "βΉοΈ IntegrationsPlugin not accessible from container" | |
| fi | |
| echo "π Summary: $plugin_count plugins accessible from container" | |
| # List all available plugins | |
| echo "π All plugins in container:" | |
| docker exec mautic_web find /var/www/html/docroot/plugins -maxdepth 1 -type d | tail -n +2 | head -10 || echo "No plugins found in container" | |
| EOF | |
| - name: Setup SSH for manual upgrade test | |
| run: | | |
| echo "π Setting up SSH for manual upgrade testing..." | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
| chmod 600 ~/.ssh/id_rsa | |
| - name: Test version upgrade manually | |
| run: | | |
| echo "π Testing Mautic version upgrade from 6.0.4 to 6.0.5..." | |
| VPS_IP="${{ steps.deploy.outputs.vps-ip }}" | |
| if [ -z "$VPS_IP" ]; then | |
| echo "β Error: VPS_IP is empty!" | |
| exit 1 | |
| fi | |
| echo "π Updating Mautic version configuration on VPS: $VPS_IP" | |
| # SSH into VPS and modify the version, then trigger upgrade | |
| ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa root@${VPS_IP} << 'EOF' | |
| cd /var/www | |
| echo "π Current deploy.env contents:" | |
| cat deploy.env | |
| echo "" | |
| echo "π Updating MAUTIC_VERSION to 6.0.5-apache..." | |
| sed -i 's/MAUTIC_VERSION=.*/MAUTIC_VERSION=6.0.5-apache/' deploy.env | |
| echo "β Updated deploy.env contents:" | |
| cat deploy.env | |
| echo "" | |
| echo "π Re-running setup script to trigger upgrade detection..." | |
| ./setup 2>&1 | tee /var/log/upgrade-test.log | |
| EOF | |
| echo "β Version upgrade test completed" | |
| - name: Verify upgrade worked | |
| run: | | |
| echo "π Verifying the upgrade was successful..." | |
| VPS_IP="${{ steps.deploy.outputs.vps-ip }}" | |
| MAUTIC_URL="${{ steps.deploy.outputs.mautic-url }}" | |
| # Download upgrade log | |
| scp -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa root@${VPS_IP}:/var/log/upgrade-test.log ./upgrade-test.log || echo "Could not download upgrade log" | |
| # Check if upgrade was detected | |
| if [ -f ./upgrade-test.log ]; then | |
| echo "π Checking upgrade log for update indicators..." | |
| if grep -q "Version mismatch:" ./upgrade-test.log; then | |
| echo "β PASS: Version update was detected" | |
| else | |
| echo "β FAIL: Version update was not detected" | |
| echo "π Recent log entries:" | |
| tail -20 ./upgrade-test.log | |
| exit 1 | |
| fi | |
| if grep -q "Containers recreated successfully" ./upgrade-test.log; then | |
| echo "β PASS: Containers were updated successfully" | |
| else | |
| echo "β FAIL: Container update failed" | |
| echo "π Checking for alternative success indicators..." | |
| if grep -q "Mautic update completed successfully" ./upgrade-test.log; then | |
| echo "β PASS: Mautic update completed successfully" | |
| else | |
| echo "β No success indicators found" | |
| exit 1 | |
| fi | |
| fi | |
| fi | |
| # Verify Mautic is still working after upgrade | |
| echo "π Testing Mautic accessibility after upgrade..." | |
| HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" "${MAUTIC_URL}/s/login" 2>/dev/null || echo "000") | |
| echo "π HTTP response code: $HTTP_CODE" | |
| if [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "302" ]; then | |
| echo "β PASS: Mautic is still accessible after upgrade (HTTP $HTTP_CODE)" | |
| # Check that it's actually the new version by inspecting container | |
| echo "π Verifying container is running new version..." | |
| CONTAINER_IMAGE=$(ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa root@${VPS_IP} "docker inspect mautic_web --format='{{.Config.Image}}' 2>/dev/null || echo 'unknown'") | |
| echo "π¦ Container image: $CONTAINER_IMAGE" | |
| if echo "$CONTAINER_IMAGE" | grep -q "6.0.5-apache"; then | |
| echo "β PASS: Container is running Mautic 6.0.5-apache" | |
| else | |
| echo "β FAIL: Container is not running expected version" | |
| exit 1 | |
| fi | |
| else | |
| echo "β FAIL: Mautic is not accessible after upgrade" | |
| exit 1 | |
| fi | |
| echo "π All version upgrade validation checks passed!" | |
| echo "π Integration test completed successfully:" | |
| echo " β Initial deployment with Mautic 6.0.4" | |
| echo " β Version upgrade to 6.0.5 without reinstallation" | |
| echo " β Proper maintenance and migration execution" | |
| echo " β Container version verification" | |
| - name: Cleanup test droplet | |
| if: always() | |
| run: | | |
| echo "π§Ή Cleaning up test droplet..." | |
| TEST_NAME="${{ steps.test-name.outputs.test-name }}" | |
| # Install doctl | |
| doctl auth init --access-token "${{ secrets.DIGITALOCEAN_TOKEN }}" | |
| # Delete the test droplet | |
| if doctl compute droplet list | grep -q "$TEST_NAME"; then | |
| echo "Deleting droplet: $TEST_NAME" | |
| doctl compute droplet delete "$TEST_NAME" --force | |
| echo "β Test droplet deleted" | |
| else | |
| echo "βΉοΈ Test droplet not found (may have failed to create)" | |
| fi | |
| - name: Upload test artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: integration-test-logs-${{ github.run_number }} | |
| path: | | |
| ./setup-dc.log | |
| ./deploy.env | |
| if-no-files-found: warn | |
| retention-days: 7 |