Fix curl error handling - avoid concatenated error codes #5
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: Deployment Timing Tests | |
| # Tests for LDEV-5478 / LDEV-5960 - deploy folder timing issues | |
| # Verifies that extensions in the deploy folder are fully initialized before requests are served | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| lucee_versions: | |
| required: false | |
| description: Lucee Versions (json array) | |
| default: '["7.0/stable/jar", "6.2/stable/jar"]' | |
| type: string | |
| push: | |
| branches: | |
| - deployment-tests | |
| paths: | |
| - 'custom/deployment-tests/**' | |
| - '.github/workflows/deployment-tests.yml' | |
| env: | |
| EXPRESS_TEMPLATE_URL: https://cdn.lucee.org/express-templates/lucee-tomcat-11.0.13-template.zip | |
| jobs: | |
| # First job: Build the test extensions | |
| build-extensions: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 11 | |
| distribution: temurin | |
| - name: Cache Maven packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2 | |
| key: maven-cache-extensions | |
| - name: Build slow-startup extension | |
| run: | | |
| cd custom/deployment-tests/extensions/slow-startup | |
| mvn package -q | |
| ls -la target/ | |
| echo "Extension built:" | |
| unzip -l target/*.lex | |
| - name: Upload slow-startup extension | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: slow-startup-extension | |
| path: custom/deployment-tests/extensions/slow-startup/target/*.lex | |
| retention-days: 1 | |
| # Second job: Test deployment timing with various Lucee versions | |
| test-deploy-timing: | |
| needs: build-extensions | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| luceeVersion: ${{ fromJSON(github.event.inputs.lucee_versions || '["7.0/stable/jar", "6.2/stable/jar"]') }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 21 | |
| distribution: temurin | |
| - name: Download slow-startup extension | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: slow-startup-extension | |
| path: extensions/ | |
| - name: Download Lucee Express template | |
| run: | | |
| curl -L -o express-template.zip "$EXPRESS_TEMPLATE_URL" | |
| unzip -q express-template.zip -d express | |
| - name: Download Lucee JAR | |
| run: | | |
| # Get Lucee JAR filename via update API | |
| LUCEE_FILENAME=$(curl -s "https://update.lucee.org/rest/update/provider/latest/${{ matrix.luceeVersion }}/filename" | tr -d '"') | |
| echo "Lucee filename: $LUCEE_FILENAME" | |
| LUCEE_URL="https://cdn.lucee.org/$LUCEE_FILENAME" | |
| echo "Downloading from: $LUCEE_URL" | |
| curl -L -f -o lucee.jar "$LUCEE_URL" | |
| # Validate JAR | |
| if ! unzip -t lucee.jar > /dev/null 2>&1; then | |
| echo "ERROR: Downloaded JAR is corrupt!" | |
| exit 1 | |
| fi | |
| # Install into Express | |
| rm -f express/lib/lucee-*.jar | |
| cp lucee.jar express/lib/ | |
| - name: Prepare test environment | |
| run: | | |
| echo "## Test: ${{ matrix.luceeVersion }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| # Copy test script to webroot | |
| cp custom/deployment-tests/test-slow-startup.cfm express/webapps/ROOT/ | |
| # Copy extension to deploy folder BEFORE starting Lucee | |
| mkdir -p express/lucee-server/deploy/ | |
| cp extensions/*.lex express/lucee-server/deploy/ | |
| echo "Extension in deploy folder:" | |
| ls -la express/lucee-server/deploy/ | |
| # Configure trace logging | |
| echo 'export LUCEE_LOGGING_FORCE_LEVEL=trace' >> express/bin/setenv.sh | |
| chmod +x express/bin/setenv.sh | |
| # Configure Tomcat port | |
| sed -i 's/port="8080"/port="8888"/g' express/conf/server.xml | |
| - name: Start Lucee and test IMMEDIATELY (no sleep!) | |
| id: test | |
| run: | | |
| cd express | |
| # Start Lucee | |
| echo "Starting Lucee Express..." | |
| ./bin/catalina.sh start | |
| echo "Lucee started" | |
| # Make request IMMEDIATELY - this is the key test! | |
| # If LDEV-5478 exists, this will fail because onStart() hasn't completed | |
| echo "Making immediate request (no delay)..." | |
| # Try up to 60 times with 1 second between attempts | |
| # The first few will fail due to Tomcat not being ready yet | |
| # But once Tomcat IS ready, if the extension isn't, that's the bug! | |
| for i in {1..60}; do | |
| echo "Attempt $i..." | |
| HTTP_CODE=$(curl -s -o /tmp/response.txt -w "%{http_code}" http://127.0.0.1:8888/test-slow-startup.cfm 2>/dev/null) || HTTP_CODE="000" | |
| echo "HTTP Code: $HTTP_CODE" | |
| if [ "$HTTP_CODE" != "000" ] && [ -f /tmp/response.txt ]; then | |
| # Got a response from Tomcat | |
| echo "=== Response ===" | |
| cat /tmp/response.txt | |
| echo "" | |
| echo "================" | |
| if [ "$HTTP_CODE" = "200" ]; then | |
| echo "TEST PASSED: Extension ready on first request" | |
| echo "### Result: PASSED" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| cat /tmp/response.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| exit 0 | |
| else | |
| echo "TEST FAILED: Extension NOT ready - LDEV-5478 reproduced!" | |
| echo "### Result: FAILED (LDEV-5478 reproduced)" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| cat /tmp/response.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| exit 1 | |
| fi | |
| fi | |
| sleep 1 | |
| done | |
| echo "TEST INCONCLUSIVE: Tomcat never responded" | |
| echo "### Result: INCONCLUSIVE (Tomcat timeout)" >> $GITHUB_STEP_SUMMARY | |
| exit 1 | |
| - name: Stop Lucee | |
| if: always() | |
| run: | | |
| cd express | |
| ./bin/shutdown.sh || true | |
| - name: Show catalina.out | |
| if: always() | |
| run: | | |
| echo "=== catalina.out ===" | |
| cat express/logs/catalina.out || echo "No catalina.out found" | |
| - name: Upload logs on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: lucee-logs-${{ contains(matrix.luceeVersion, '7.0') && 'v7' || 'v6' }} | |
| path: | | |
| express/logs/ | |
| express/lucee-server/context/logs/ |