Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-61199

Job Configuration History Plugin doesn't seem to honor "Max number of days to keep history entries" for deleted jobs

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • Jenkins 2.204.2 (newest LTS)
      Job Configuration History Plugin 2.24 (most recent)
      Java OpenJDK8U-jdk_x64_linux_hotspot_8u232b09
      Running on Redhat 7
      No container

      I have configured the plugin as follow:

      • Use different history directory than default:: [Empty]
      • Max number of history entries to keep: 20
      • Max number of days to keep history entries: 365
      • Max number of history entries to show per page: [Empty]
      • Configuration exclude file pattern: queue|nodeMonitors|UpdateCenter|global-build-stats
      • Do not save duplicate history: ON

        * Save Maven module configuration changes
        : ON

        * Show build badges: Always
      • Exclude users: [Empty]

      Now to my amazement, I found on the FS files like:
      drwxr-xr-x 6 lthy ne 4096 Nov 11 2016 home/config-history/jobs/testJob_deleted_20161111_152741_018
      drwxr-xr-x 6 lthy ne 4096 Jun 29 2016 home/config-history/jobs/testMultiBranch_deleted_20160629_190653_773
      drwxr-xr-x 8 ltphy ne 4096 Aug 30 2016 home/config-history/jobs/Try1_deleted_20160830_093601_349

      So this looks like the job got deleted in 2016. (I have similar cases for later years.)

      With "Max number of days to keep history entries: 365" I would have expected everything deleted more than a year ago to be removed.

          [JENKINS-61199] Job Configuration History Plugin doesn't seem to honor "Max number of days to keep history entries" for deleted jobs

          This might be a permission issue. Your ls shows two different users: lthy and ltphy. The files only have write permission for their own user, so the user lthy cannot delete a file of user ltphy and vice versa.

          What's your jenkins system user? If your jenkins system user isn't lthy nor ltphy, JobConfigHistory cannot delete these files.

          Could you also check the jenkins logfile? You should see some entries like Should delete: <filename> and maybe a warning like problem deleting history file: <filename>.

          Jochen A. Fürbacher added a comment - This might be a permission issue. Your ls shows two different users: lthy and ltphy . The files only have write permission for their own user, so the user lthy cannot delete a file of user ltphy and vice versa. What's your jenkins system user? If your jenkins system user isn't lthy nor ltphy , JobConfigHistory cannot delete these files. Could you also check the jenkins logfile? You should see some entries like Should delete: <filename> and maybe a warning like problem deleting history file: <filename> .

          Rainer Gruber added a comment -

          I have the same problem, but the permissions are correct (jenkins user, permissons drwxrwxr-x, no warnings in log).

          • as I can see: the history entries for active jobs are deleted after the specified number of days
          • deleted jobs (e.g. zzz_deleted_20181119_105513_317) are too old but seem to be untouched. All history-timestamp directory are too old but all stay in filesystem.
          • A look at the sources: JobConfigHistoryPurger iterates in purgeSystemOrJobHistory will delete the inner timestamp directory using method deleteDirectory(historyDir) - but I didn't find the code where the outer directory like 'zzz_deleted_20181119_105513_317' should be deleted.

           

          System: Redhat Enterprise Linux 7, Jenkins 2.245, Job Config History Plugin 2.26

          Plugin configuration (unmentioned fields are empty):

          • max number of days=183
          • do not save duplicate history
          • build badges=always
          • show change message window

           

          Rainer Gruber added a comment - I have the same problem, but the permissions are correct (jenkins user, permissons drwxrwxr-x, no warnings in log). as I can see: the history entries for active jobs are deleted after the specified number of days deleted jobs (e.g. zzz_deleted_20181119_105513_317) are too old but seem to be untouched. All history-timestamp directory are too old but all stay in filesystem. A look at the sources: JobConfigHistoryPurger iterates in purgeSystemOrJobHistory will delete the inner timestamp directory using method deleteDirectory(historyDir) - but I didn't find the code where the outer directory like 'zzz_deleted_20181119_105513_317' should be deleted.   System: Redhat Enterprise Linux 7, Jenkins 2.245, Job Config History Plugin 2.26 Plugin configuration (unmentioned fields are empty): max number of days=183 do not save duplicate history build badges=always show change message window  

          Martin added a comment -

          I have this problem too (still). All job-history-config directories are owned by the same user.

          I have "Max number of days to keep history entries" set to 90, but deleted jobs are stored for years back.

          Jenkins 2.414.2, Job Config History Plugin 1229.v3039470161a_d

          Martin added a comment - I have this problem too (still). All job-history-config directories are owned by the same user. I have "Max number of days to keep history entries" set to 90, but deleted jobs are stored for years back. Jenkins 2.414.2, Job Config History Plugin 1229.v3039470161a_d

            stefanbrausch Stefan Brausch
            martinjost Martin Jost
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: