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

Corner case in job deletion without history?

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Done
    • Labels:
      None
    • Environment:
      jobconfighistory-plugin 2.15, Jenkins 1.609.3 (yeah, rather elderly)
    • Similar Issues:

      Description

      I installed the jobconfighistory-plugin (nice), then I deleted some jobs.

      I had assumed that I would end up with a deleted-job entry that contained a copy of the job just prior to deletion. What I actually ended up with was just a deleted-job entry.

      [Fortunately, for these jobs, that's fine].

      It looks to me (from an admittedly cursory look at the code) as though FileHistoryDao.deleteItem(Item) saves the history of the job. So I think that if, between installing the plugin and deleting the job, I had made any changes to the job, those would have created history entries that included a copy of the job, and then when I deleted the job all of that would have been saved. (Right?)

      Quite likely that's good enough and it doesn't really make sense to do anything about the corner case that I found, or perhaps it's even the intended behaviour, but I'm logging it just in case.

        Attachments

          Activity

          Hide
          jochenafuerbacher Jochen A. Fürbacher added a comment -

          You are right. However, if a job is not disabled and you delete a job, the Jenkins core internally first disables the job and than deletes it. So in this case you get two history entries, the first one with a copy of the job config (job was enabled).

          Show
          jochenafuerbacher Jochen A. Fürbacher added a comment - You are right. However, if a job is not disabled and you delete a job, the Jenkins core internally first disables the job and than deletes it. So in this case you get two history entries, the first one with a copy of the job config (job was enabled).
          Hide
          maslen Thomas Maslen added a comment -

          Aha.  Thanks – I haven't tried it, but that sounds like a pretty good workaround, and makes this an ever more minor corner case.  I can't remember with certainty whether I had already disabled the jobs before deleting them but yes, I think it's very likely that I did

          1. Disable job
          2. Install jobconfighistory-plugin
          3. Delete job

          and hence encountered this issue, whereas (per your note) any other sequence would have been just fine.

          Show
          maslen Thomas Maslen added a comment - Aha.  Thanks – I haven't tried it, but that sounds like a pretty good workaround, and makes this an ever more minor corner case.  I can't remember with certainty whether I had already disabled the jobs before deleting them but yes, I think it's very likely that I did Disable job Install jobconfighistory-plugin Delete job and hence encountered this issue, whereas (per your note) any other sequence would have been just fine.

            People

            Assignee:
            jochenafuerbacher Jochen A. Fürbacher
            Reporter:
            maslen Thomas Maslen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: