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

Pipeline Job-- deletedir() delete only current directory but @script and @tmp dir still there in workspace.

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      Jenkins 2.244

      Description

      Directories with an ampersand (like @tmp and @script, @libs) are not removed when using 'deletedir()' in pipeline stage.

      They are never cleaned up, even by the built in build discarders,
      On our instances we have 2172 folders with @libs (which is a copy of the shared library for the build)
      Which is taking up 7GB of space

        Attachments

          Issue Links

            Activity

            Hide
            timja Tim Jacomb added a comment -

            Not that I know of, is there a reason that the automated cleanup isn't enough for you?

            Show
            timja Tim Jacomb added a comment - Not that I know of, is there a reason that the automated cleanup isn't enough for you?
            Hide
            cmamigonian Camden Mamigonian added a comment -

            If we have lots of jobs running on an agent our storage can fill up quickly, and we like to clean up after ourselves once the pipeline is done running.  We currently have a way to do it, but it's through our own code instead of a much simpler single call to either cleanWs or deleteDir.

            Show
            cmamigonian Camden Mamigonian added a comment - If we have lots of jobs running on an agent our storage can fill up quickly, and we like to clean up after ourselves once the pipeline is done running.  We currently have a way to do it, but it's through our own code instead of a much simpler single call to either cleanWs or deleteDir.
            Hide
            naveeno Naveen B added a comment -

            We are still seeing this issue in 2.277.1

            @tmp is left behind after

            {{}}

            dir('tst'){
                sh (
                    label : "ls",
                    script : "ls"
                )
                deleteDir()
            }

            {{}}

            Show
            naveeno Naveen B added a comment - We are still seeing this issue in 2.277.1 @tmp is left behind after {{}} dir( 'tst' ){ sh ( label : "ls" , script : "ls" ) deleteDir() } {{}}
            Hide
            timja Tim Jacomb added a comment -

            The resolution was a background task that will remove them, deleteDir only deletes the current directory

            Show
            timja Tim Jacomb added a comment - The resolution was a background task that will remove them, deleteDir only deletes the current directory
            Hide
            jglick Jesse Glick added a comment -

            Yeah the Fixed resolution does not match the reported issue summary. deleteDir does exactly what it is documented to do: delete the contextual directory (which could be a subdirectory of the workspace, something else entirely, etc.), just like sh 'rm -rf .' basically.

            Show
            jglick Jesse Glick added a comment - Yeah the Fixed resolution does not match the reported issue summary. deleteDir does exactly what it is documented to do: delete the contextual directory (which could be a subdirectory of the workspace, something else entirely, etc.), just like sh 'rm -rf .' basically.

              People

              Assignee:
              timja Tim Jacomb
              Reporter:
              hiten_prajapati Hiten Prajapati
              Votes:
              67 Vote for this issue
              Watchers:
              89 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: