fix: discard the build record git:sync starts when nothing is built
cmd-git-sync calls dokku_setup_build_capture before the clone/fetch, because it cannot know whether there is anything to deploy until it has fetched. Both paths that then decline to build - a plain `git:sync` with no build flag, and a `--build-if-changes` poll that finds the remote unchanged - returned without ever finalizing that record. The record stayed at status=running forever, which has three consequences on an app polled on a timer: - PruneAppBuilds only runs from builds-record-finalize, so nothing prunes the ticks while the app is idle; they accumulate without bound, invisibly, because builds:list caps output at the retention count. - The next real deploy's ReapAbandonedBuilds finalizes each of them as status=failed, exit_code=-1, with finished_at stamped at the moment of reaping - indistinguishable on disk from a build that really failed, and with a duration that grew to the polling interval. - That same deploy's prune then keeps the newest records by started_at, which after an idle stretch are the ticks, deleting the last real deploy's record and log. Add a builds-record-discard trigger that removes a non-terminal record and its log, and call it from both no-op paths in cmd-git-sync. The trigger leaves missing and already-terminal records alone, so it can never delete real history. Fixes #9030 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
aa39920cc7
commit
dc27668e09
10 files changed
+188
-1
No files matched your search
@@ -25,6 +25,8 @@ Every build is identified by a sortable base36 ULID-style id (`DOKKU_BUILD_ID`)
|
||||
|
||||
Output is also tagged into syslog as `dokku-<build-id>` so `journalctl -t dokku-<build-id>` continues to work. The on-disk log file is the durable source of truth and is read for `builds:output` even when journald has rotated old entries away.
|
||||
|
||||
A run that builds nothing leaves no record behind. `git:sync` has to fetch before it can tell whether there is anything to deploy, so it opens a record up front and discards it again when it turns out there is not - a `git:sync` with no `--build` flag, or a `--build-if-changes` poll that finds the remote unchanged. Without that, an app polled on a timer would accumulate `running` records that are later reaped as spurious failures, pushing real deploys out of the retention window.
|
||||
|
||||
### Record schema
|
||||
|
||||
```json
|
||||
|
||||
Reference in new issue
Block a user