Commit 8b0f5e7
fix: deactivate stale in-progress deployments before creating new ones
When the Kustomization is updated in quick succession, GitHub Deployments
can become orphaned — stuck in `in_progress` forever because the
deployment-id annotation in the GitOps repo gets overwritten by the
subsequent run and the flux-deployment-reporter only sees the latest ID.
This adds a `deactivate_stale_deployments` function that runs before each
new deployment creation. It queries existing deployments for the target
environment and marks any with status `in_progress`, `queued`, or `pending`
as `inactive`. The cleanup is best-effort and idempotent.
Co-Authored-By: Claude <claude@anthropic.com>1 parent 2f0c038 commit 8b0f5e7
1 file changed
Lines changed: 40 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
337 | 374 | | |
338 | 375 | | |
339 | 376 | | |
340 | 377 | | |
341 | 378 | | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
342 | 382 | | |
343 | 383 | | |
344 | 384 | | |
| |||
0 commit comments