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

    • 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

            timja Tim Jacomb added a comment -

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

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

            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.

            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.
            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()
            }

            {{}}

            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() } {{}}
            timja Tim Jacomb added a comment -

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

            timja Tim Jacomb added a comment - The resolution was a background task that will remove them, deleteDir only deletes the current directory
            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.

            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

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

              Dates

                Created:
                Updated:
                Resolved: