fix!: remove the dbfs log workaround and require Gitea 1.26.2 (#1395)

Gitea 1.26.2 finalizes logs on an empty `UpdateLog` with `NoMore` (https://github.com/go-gitea/gitea/pull/37687), so the sentinel row is no longer needed. On older servers, the final log of most jobs would never be archived and stays in `dbfs_data`, so this raises the minimum Gitea version. It lives in `ver.MinGiteaVersion`, which the error for servers without `Declare` now names.

Fixes: https://gitea.com/gitea/runner/issues/953
Co-authored-by: silverwind <[email protected]>
Reviewed-on: https://gitea.com/gitea/runner/pulls/1395
Reviewed-by: silverwind <[email protected]>
Co-authored-by: bircni <[email protected]>
This commit is contained in:
bircniandsilverwind authored and silverwind committed 2026-11-10 11:35:16 +00:00
1 parent c59caa9689
commit 84c0fcd1fa
6 files changed
+6 -20

No files matched your search

-16
View File
@@ -691,22 +691,6 @@ func (r *Reporter) Close(lastWords string) error {
logging.Errorf("No Response from RunDaemon for %s, continue best effort", r.daemonWait)
}
// Gitea's UpdateLog short-circuits on len(Rows)==0 before honoring NoMore,
// so a final empty request never runs TransferLogs and dbfs_data leaks.
// Inject a sentinel row after the daemon has exited so it can't be flushed
// before ReportLog(true).
// TODO: Remove after https://github.com/go-gitea/gitea/pull/37631 is in all
// supported branches, e.g. v1.28+.
r.stateMu.Lock()
if len(r.logRows) == 0 {
// Not appendLogRow: the sentinel is not job output and has no place in job.log.
r.logRows = append(r.logRows, &runnerv1.LogRow{
Time: timestamppb.Now(),
Content: "",
})
}
r.stateMu.Unlock()
// Separate budgets so a slow ReportLog can't starve the ReportState that
// carries the cancel acknowledgement.
err := errors.Join(
+2 -2
View File
@@ -355,7 +355,7 @@ func TestReporter_StateNotifyFlush(t *testing.T) {
})
}
func TestReporter_CloseAlwaysSendsRowsWithNoMore(t *testing.T) {
func TestReporter_CloseFinalizesLogWithoutRows(t *testing.T) {
var lastReq atomic.Pointer[runnerv1.UpdateLogRequest]
var noMoreCalls atomic.Int64
@@ -400,7 +400,7 @@ func TestReporter_CloseAlwaysSendsRowsWithNoMore(t *testing.T) {
final := lastReq.Load()
require.NotNil(t, final)
assert.True(t, final.NoMore, "final UpdateLog must carry NoMore=true")
assert.NotEmpty(t, final.Rows, "final UpdateLog must carry at least one row")
assert.Empty(t, final.Rows, "a job without output must not get a log row")
}
func TestReporter_StateHeartbeat(t *testing.T) {
+2
View File
@@ -6,6 +6,8 @@ package ver
// go build -ldflags "-X gitea.com/gitea/runner/internal/pkg/ver.version=1.2.3"
var version = "dev"
const MinGiteaVersion = "1.26.2" // also in the README.md prerequisites
func Version() string {
return version
}