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

Support for deleting workspace when leaving agent

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: core
    • Labels:
      None
    • Similar Issues:

      Description

      It would be great with support for deleting the workspace when a job leaves an agent. In a setup with shared agents, the disk space for the workspaces tend to grow. One solution is for all jobs to have deleteDir() in their pipeline, but empirical real-world testing shows that users forget or don't care (or don't understand that they need to do this for every agent used in the build).

      This should most likely not be the default but either configurable or at least some sort of API support so that a plugin could add this behavior.

        Attachments

          Activity

          Hide
          ahammar Anders Hammar added a comment -

          After some investigation I think that this could be accomplished by using the NodeProperty extension point and providing an Environment in setUp(). The workspace cleanup could then be done in Environment.tearDown().
          However, trying this I can't get it to work for a pipeline. It seems that NodeProperty.setUp() isn't called. It does work for a Freestyle project though. Don't understand why there's a difference.

          Show
          ahammar Anders Hammar added a comment - After some investigation I think that this could be accomplished by using the NodeProperty extension point and providing an Environment in setUp(). The workspace cleanup could then be done in Environment.tearDown(). However, trying this I can't get it to work for a pipeline. It seems that NodeProperty.setUp() isn't called. It does work for a Freestyle project though. Don't understand why there's a difference.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            ahammar Anders Hammar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: