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

Delete workspaces when deleting a job

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      When working with many short-lived feature branches, Jenkins can start to eat up a lot of disk space by leaving old workspaces around from old builds.

      This seems to be especially true with the Pipeline Multibranch Plugin. When that plugin deletes the job for a branch when the branch is deleted, it should simultaneously clean up any of the workspaces created for that branch job (e.g. "feature-foo", "feature-foo@2", "feature-foo@3", etc).

        Attachments

          Issue Links

            Activity

            Hide
            cobexer Ing. Christoph Obexer added a comment -

            YES! Actually I want to limit a multi-branch pipeline to only keep the 3 most used branches around (like master, and two currently used feature branches).

            A "Number of most frequently used branches to keep" setting would be awesome IMO.

            Show
            cobexer Ing. Christoph Obexer added a comment - YES! Actually I want to limit a multi-branch pipeline to only keep the 3 most used branches around (like master, and two currently used feature branches). A "Number of most frequently used branches to keep" setting would be awesome IMO.
            Hide
            vmwiz Gilles Nedostoupof added a comment -

            Would be nice to have a configurable trigger "onBranchDelete" to execute custom cleaning scripts like the "Post-build Actions" in normal jobs.

            In my workflow, I'm deploying feature branches code and database to a testing environment which should be cleaned once the feature branches have been merged and deleted.

            Show
            vmwiz Gilles Nedostoupof added a comment - Would be nice to have a configurable trigger "onBranchDelete" to execute custom cleaning scripts like the "Post-build Actions" in normal jobs. In my workflow, I'm deploying feature branches code and database to a testing environment which should be cleaned once the feature branches have been merged and deleted.
            Hide
            shakefu Jake Alheid added a comment -

            We have a large, multi-gigabyte repository, and this bug is repeatedly causing us to either have to go in and manually clean out old branches, or giving test failures because hundreds of gigabytes of space are being taken up in a short time due to the multiple checkouts.

            Please fix!

            Show
            shakefu Jake Alheid added a comment - We have a large, multi-gigabyte repository, and this bug is repeatedly causing us to either have to go in and manually clean out old branches, or giving test failures because hundreds of gigabytes of space are being taken up in a short time due to the multiple checkouts. Please fix!
            Hide
            nickj Nicholas Bencriscutto added a comment -

            We are also experiencing this. It seems to cause issues at the most inconvenient time. (Of course when would it ever be convenient). We have temporarily set up a very conservative cron style jenkins job to clean out the jobs in the wee hours of the morning, but that could potentially cause problems down the line. Would like to keep the cleanup in house on a per job basis.

            Show
            nickj Nicholas Bencriscutto added a comment - We are also experiencing this. It seems to cause issues at the most inconvenient time. (Of course when would it ever be convenient). We have temporarily set up a very conservative cron style jenkins job to clean out the jobs in the wee hours of the morning, but that could potentially cause problems down the line. Would like to keep the cleanup in house on a per job basis.
            Hide
            jglick Jesse Glick added a comment -

            I think this is actually a more general core issue: Job.delete (or some associated ItemListener.onDeleted should proactively delete any associated workspaces it can find on any connected nodes. WorkspaceCleanupThread as currently implemented is not going to find them.

            Show
            jglick Jesse Glick added a comment - I think this is actually a more general core issue: Job.delete (or some associated ItemListener.onDeleted should proactively delete any associated workspaces it can find on any connected nodes. WorkspaceCleanupThread as currently implemented is not going to find them.
            Hide
            jglick Jesse Glick added a comment -

            JENKINS-22240 is very similar; probably both could and should be fixed together.

            Show
            jglick Jesse Glick added a comment - JENKINS-22240 is very similar; probably both could and should be fixed together.

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              pioto Mike Kelly
              Votes:
              7 Vote for this issue
              Watchers:
              21 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: