Class RetentionPeriodicWork

java.lang.Object
java.util.TimerTask
hudson.triggers.SafeTimerTask
hudson.model.PeriodicWork
io.jenkins.plugins.batchcontrol.ops.RetentionPeriodicWork
All Implemented Interfaces:
ExtensionPoint, Runnable

@Extension @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public class RetentionPeriodicWork extends PeriodicWork
Daily retention cleanup (SPEC item 12): deletes every month bucket older than the configured retentionMonths — the runs and changes JSONL files, that month's diff patches, and that month's incidents (index + XMLs) — and records each deleted month as ChangeRecord(type=RETENTION) identifying the month as YYYY-MM.

A month is deleted when it lies strictly before currentMonth - retentionMonths, so the current (partial) month plus the last retentionMonths full months are always kept (conservative deletion). Closed requests and ended grants last active before that month are deleted too. Every deletion holds only the lock of the file it deletes, so the sweep never stalls the queue gate or build completion.

This is a synchronous PeriodicWork (not AsyncPeriodicWork, whose doRun() is public final and merely starts a background thread): the test contract calls doRun() directly and asserts the cleanup has completed on return, and a once-a-day directory sweep is cheap enough to run inline.

  • Constructor Details

    • RetentionPeriodicWork

      public RetentionPeriodicWork()
  • Method Details