From 208df3496fbe2ae9827ac9f4c3c2e071da692d61 Mon Sep 17 00:00:00 2001 From: snomiao Date: Wed, 20 Aug 2025 09:06:32 +0000 Subject: [PATCH] [ci] Add retry logic to wrangler page deploy step MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Implement 3-attempt retry mechanism for Cloudflare Pages deployment - Add 10-second delay between retry attempts - Install wrangler globally to ensure CLI availability - Maintain existing functionality while improving stability 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/test-ui.yaml | 37 +++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-ui.yaml b/.github/workflows/test-ui.yaml index 4a51573015..45a84d23a6 100644 --- a/.github/workflows/test-ui.yaml +++ b/.github/workflows/test-ui.yaml @@ -162,6 +162,9 @@ jobs: run: npx playwright install chromium --with-deps working-directory: ComfyUI_frontend + - name: Install Wrangler + run: npm install -g wrangler + - name: Run Playwright tests (${{ matrix.browser }}) id: playwright run: npx playwright test --project=${{ matrix.browser }} --reporter=html @@ -177,11 +180,35 @@ jobs: - name: Deploy to Cloudflare Pages (${{ matrix.browser }}) id: cloudflare-deploy if: always() - uses: cloudflare/wrangler-action@v3 - with: - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - command: pages deploy ComfyUI_frontend/playwright-report --project-name=${{ steps.project-name.outputs.name }} --branch=${{ steps.project-name.outputs.branch }} + run: | + # Retry logic for wrangler deploy (3 attempts) + RETRY_COUNT=0 + MAX_RETRIES=3 + SUCCESS=false + + while [ $RETRY_COUNT -lt $MAX_RETRIES ] && [ $SUCCESS = false ]; do + RETRY_COUNT=$((RETRY_COUNT + 1)) + echo "Deployment attempt $RETRY_COUNT of $MAX_RETRIES..." + + if npx wrangler pages deploy ComfyUI_frontend/playwright-report --project-name=${{ steps.project-name.outputs.name }} --branch=${{ steps.project-name.outputs.branch }}; then + SUCCESS=true + echo "Deployment successful on attempt $RETRY_COUNT" + else + echo "Deployment failed on attempt $RETRY_COUNT" + if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then + echo "Retrying in 10 seconds..." + sleep 10 + fi + fi + done + + if [ $SUCCESS = false ]; then + echo "All deployment attempts failed" + exit 1 + fi + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - name: Save deployment info for summary if: always()