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.

    • Jenkins 2.244

      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

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

          Hiten Prajapati created issue -

          Ryan Campbell added a comment -

          Please reopen with step by step instructions to reproduce the problem and clear description of what you expect to happen.

          Ryan Campbell added a comment - Please reopen with step by step instructions to reproduce the problem and clear description of what you expect to happen.
          Ryan Campbell made changes -
          Resolution New: Incomplete [ 4 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

          Stefan Droog added a comment - - edited

          Multibranch pipeline (Jenkinsfile):

           

          stage('Checkout') {
          checkout scm
          }
          
          stage('Build') { 
          def resultDist = sh returnStdout: true, script: './gradlew build'
          println resultDist
          }
          
          stage('Cleanup') {
          deleteDir()
          }
          

          This will create some directories in the Jenkins workspace, e.g: 

          MyBranch-GWI555O7BRZQK2BI4NIP67CEYQUZYH36AKCBALPQ2TWX4CIGNYIZ
          MyBranch-GWI555O7BRZQK2BI4NIP67CEYQUZYH36AKCBALPQ2TWX4CIGNYIZ@tmp

          After the 'Cleanup' stage the directories with an ampersand are still there

          We expect that all directories are removed.

          Stefan Droog added a comment - - edited Multibranch pipeline (Jenkinsfile):   stage( 'Checkout' ) { checkout scm } stage( 'Build' ) { def resultDist = sh returnStdout: true , script: './gradlew build' println resultDist } stage( 'Cleanup' ) { deleteDir() } This will create some directories in the Jenkins workspace, e.g:  MyBranch-GWI555O7BRZQK2BI4NIP67CEYQUZYH36AKCBALPQ2TWX4CIGNYIZ MyBranch-GWI555O7BRZQK2BI4NIP67CEYQUZYH36AKCBALPQ2TWX4CIGNYIZ@tmp After the 'Cleanup' stage the directories with an ampersand are still there We expect that all directories are removed.
          Stefan Droog made changes -
          Resolution Original: Incomplete [ 4 ]
          Status Original: Closed [ 6 ] New: Reopened [ 4 ]
          Stefan Droog made changes -
          Assignee Original: Matthew DeTullio [ mjdetullio ] New: Ryan Campbell [ recampbell ]
          Matthew DeTullio made changes -
          Component/s New: pipeline [ 21692 ]
          Component/s Original: multi-branch-project-plugin (not Pipeline) [ 21127 ]
          Stefan Droog made changes -
          Description New: Directories with an ampersand (like @tmp and @script) are not removed when using 'deletedir()' in pipeline stage.

          Hiten Prajapati added a comment - - edited

          yes stefan1509 you are right.
          i am still facing this issue. 
          currently i have to delete that directory manual.

          i faced this when my storage is fully occupied, i have many branches so each branch taking lots spaces after completed build. 

          Hiten Prajapati added a comment - - edited yes stefan1509 you are right. i am still facing this issue.  currently i have to delete that directory manual. i faced this when my storage is fully occupied, i have many branches so each branch taking lots spaces after completed build. 

          I fail to understand how this issue can be set to "Important" and that importance not be explained in details. At first sight it seems like one of Minor or less priority. Not a bug by the way, more an improvement.

          So given this, I would probably not hold my breath that this is fixed anytime soon if people thinking this should be configurable or so contribute this fix.

          Baptiste Mathus added a comment - I fail to understand how this issue can be set to "Important" and that importance not be explained in details. At first sight it seems like one of Minor or less priority. Not a bug by the way, more an improvement. So given this, I would probably not hold my breath that this is fixed anytime soon if people thinking this should be configurable or so contribute this fix.

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

              Created:
              Updated:
              Resolved: