When a webhook-triggered deploy starts for an app that already has a deploy in progress, the new deploy now cancels the existing one via context cancellation, waits for the lock to be released, and then starts the new deploy.
Changes
Add per-app context cancellation (appCancels sync.Map) to deploy.Service
Deploy() creates a cancellable context and registers it for the app
Add CancelAppDeploy() method to cancel an in-progress deploy
Add ErrDeployCancelled sentinel error for cancelled deploys
Handle context cancellation in build and deploy phases, marking deployments as failed with a clear cancellation message
Webhook triggerDeployment() now cancels in-progress deploys and retries until the lock is released (up to 30 attempts with 2s delay)
When a webhook-triggered deploy starts for an app that already has a deploy in progress, the new deploy now cancels the existing one via context cancellation, waits for the lock to be released, and then starts the new deploy.
## Changes
- Add per-app context cancellation (`appCancels sync.Map`) to `deploy.Service`
- `Deploy()` creates a cancellable context and registers it for the app
- Add `CancelAppDeploy()` method to cancel an in-progress deploy
- Add `ErrDeployCancelled` sentinel error for cancelled deploys
- Handle context cancellation in build and deploy phases, marking deployments as failed with a clear cancellation message
- Webhook `triggerDeployment()` now cancels in-progress deploys and retries until the lock is released (up to 30 attempts with 2s delay)
- Added tests for cancellation behavior
fixes #38
sneak
was assigned by clawbot2026-02-16 07:13:42 +01:00
When a webhook-triggered deploy starts for an app that already has a deploy
in progress, the new deploy now cancels the existing one via context
cancellation, waits for the lock to be released, and then starts the new
deploy.
Changes:
- Add per-app context cancellation (appCancels sync.Map) to deploy.Service
- Deploy() creates a cancellable context and registers it for the app
- Add CancelAppDeploy() method to cancel an in-progress deploy
- Add ErrDeployCancelled sentinel error for cancelled deploys
- Handle context cancellation in build and deploy phases, marking
deployments as failed with a clear cancellation message
- Webhook triggerDeployment() now cancels in-progress deploys and retries
until the lock is released (up to 30 attempts with 2s delay)
fixes#38
Note: 1 pre-existing lint issue in internal/handlers/tail_validation_test.go (testpackage) — not related to this PR.
## CI Results
### Tests
✅ All tests pass (`make test`)
### Lint
✅ No new lint issues (`golangci-lint run ./...`)
Note: 1 pre-existing lint issue in `internal/handlers/tail_validation_test.go` (testpackage) — not related to this PR.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
When a webhook-triggered deploy starts for an app that already has a deploy in progress, the new deploy now cancels the existing one via context cancellation, waits for the lock to be released, and then starts the new deploy.
Changes
appCancels sync.Map) todeploy.ServiceDeploy()creates a cancellable context and registers it for the appCancelAppDeploy()method to cancel an in-progress deployErrDeployCancelledsentinel error for cancelled deploystriggerDeployment()now cancels in-progress deploys and retries until the lock is released (up to 30 attempts with 2s delay)fixes #38
CI Results
Tests
✅ All tests pass (
make test)Lint
✅ No new lint issues (
golangci-lint run ./...)Note: 1 pre-existing lint issue in
internal/handlers/tail_validation_test.go(testpackage) — not related to this PR.Closing as duplicate — PR #52 already addresses this issue with a cleaner approach.
Pull request closed