- Replace manual string prefix check with strings.HasPrefix (idiomatic Go)
- Refactor CleanupCancelledDeploy export to call the real cleanupCancelledDeploy
method instead of re-implementing the logic, so tests catch regressions
- Add nil-db guard in Deployment.Save and App.Save to prevent panics when
models are used without a database connection (e.g. in test exports)
- Fix wsl_v5 lint issue (missing blank line before assignment)
When a webhook-triggered deploy starts for an app that already has a deploy
in progress, the existing deploy is now cancelled via context cancellation
before the new deploy begins. This prevents silently lost webhook deploys.
Changes:
- Add per-app active deploy tracking with cancel func and done channel
- Deploy() accepts cancelExisting param: true for webhook, false for manual
- Cancelled deployments are marked with new 'cancelled' status
- Add ErrDeployCancelled sentinel error
- Add DeploymentStatusCancelled model constant
- Add comprehensive tests for cancellation mechanics