Skip to content

Retry CapRover operations while the server is busy - #18

Open
robertherber wants to merge 1 commit into
mainfrom
caprover-retry-on-busy
Open

robertherber wants to merge 1 commit into
mainfrom
caprover-retry-on-busy

Conversation

@robertherber

Copy link
Copy Markdown
Member

Problem

CapRover handles one operation at a time and rejects concurrent ones. In kingstinct/lifeline, 23 of the last 100 Healthcloud - Deploy PR runs failed, most in caprover-setup's Enable SSL step:

Something bad happened calling API /user/apps/appDefinitions/enablebasedomainssl
Error Code: 1000  Message: Another operation is in process for Certbot. Please wait a few seconds and try again.

Deploys that overlap fail with healthcloud app is currently in a building process.

The register step used || true, so its "App Name already exists" errors (expected when setup re-runs after a failed SSL step) were ignored, along with every other error.

Change

  • New scripts/caprover-retry.sh <command…>:
    • Retries only on CapRover's busy errors (Another operation is in process, not ready yet, currently in a building process, Too many requests), up to 8 attempts with backoff plus jitter.
    • CAPROVER_RETRY_OK is an extended regex of errors that count as success.
    • Any other error fails immediately with an ::error::.
  • caprover-setup: register, update and enable-SSL go through it. Register sets CAPROVER_RETRY_OK: App Name already exists, replacing the blanket || true.
  • caprover-deploy: caprover deploy goes through it.
  • Both actions locate the script via ${{ github.action_path }}/../../scripts/. Remote actions get the whole repository checked out, so the path resolves for callers too.

Verified

  • actionlint and shellcheck pass. The YAML parses, with the step lists unchanged.
  • Ran the script against a fake CLI:
    • busy → success: ok on attempt 2
    • "already exists" with CAPROVER_RETRY_OK: ok
    • "already exists" without it: fails immediately
    • busy every time: fails after the attempt limit

After merging

Callers pin these actions by SHA (lifeline uses 2f1c0a4…), so they need a bump to pick this up. I'll open that PR in lifeline.

🤖 Generated with Claude Code

CapRover handles one operation at a time and rejects others ('Another
operation is in process for Certbot', 'system not ready yet', 'currently
in a building process'). The setup action's SSL step failed on this for
~1 in 4 PR deploys in lifeline, and deploys failed when they overlapped.

Add scripts/caprover-retry.sh (backoff with jitter, only on busy errors)
and use it for every CapRover call in caprover-setup and caprover-deploy.
Registering an app that already exists now counts as success instead of
ignoring every error with '|| true'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant