conductor

CI task system
git clone git://git.finwo.net/app/conductor
Log | Files | Refs | README | LICENSE

004_retention.sql (1602B)


      1 -- 004_retention.sql - how long artifacts and logs are kept
      2 --
      3 -- Without this everything a run produces is kept forever, and a conductor
      4 -- that has been busy for a year is mostly old build output nobody will
      5 -- read again.
      6 --
      7 -- Each setting is NULL when the project has no opinion, in which case the
      8 -- server default applies. Zero means keep forever, which has to be
      9 -- distinguishable from "unset" or a project could not opt out of a server
     10 -- default that deletes things.
     11 --
     12 -- Artifacts have two rules and an artifact survives if either wants it:
     13 -- the last artifact_keep_runs runs are kept however old they are, and
     14 -- anything younger than artifact_keep_days is kept however many runs have
     15 -- followed it. The artifacts of the most recent successful run are kept
     16 -- regardless, so a project that has gone quiet still has something to
     17 -- download. A job that set artifacts.expire in the pipeline overrides all
     18 -- of that with an exact deadline, in either direction, since a bulky
     19 -- intermediate is worth dropping early even from a green build.
     20 --
     21 -- Logs are simpler: they go by age alone.
     22 
     23 ALTER TABLE projects ADD COLUMN artifact_keep_runs INTEGER;
     24 ALTER TABLE projects ADD COLUMN artifact_keep_days INTEGER;
     25 ALTER TABLE projects ADD COLUMN log_keep_days INTEGER;
     26 
     27 -- Distinguishes a log that was swept from one that never existed, so the
     28 -- interface can say which without guessing from an empty log_key.
     29 ALTER TABLE jobs ADD COLUMN log_expired_at INTEGER;
     30 
     31 -- The sweep walks finished jobs oldest first, per project.
     32 CREATE INDEX idx_jobs_log_sweep ON jobs (log_expired_at, finished_at);