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

Using disableDeferredWipeout within pipeline job results in no deleted workspace

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Minor Minor
    • ws-cleanup-plugin
    • None
    • wsCleanup 0.36 and Jenkins ver. 2.138.2
      Jenkins node is Fedora 28

      We are using pipeline and at the end of the pipeline we have a stage as below. We added the disableDeferredWipeout recently to make sure that all disk space of the workspace is reclaimed before the job ends. We now notice that the workspace is not deleted anymore, when we remove the disableDeferredWipeout the workspace directory is gone again. Have tried to find some logs but can't find anything.

      stage('Post cleanup') {

      step([$class: 'WsCleanup', disableDeferredWipeout: true])

      }

      In the log we only get the message below but at the end the workspace is still there

      [WS-CLEANUP] Deleting project workspace...
      [WS-CLEANUP] Deferred wipeout is disabled by the job configuration...
      [WS-CLEANUP] done

       

      As reproducer you can use the pipeline job below, only adapt the node argument. After the pipeline job has finished we would expect to have an empty workspace but with disableDeferredWipeout:true the buildtools directory is still there, without the argument the workspace is deleted

      node('Scarab_fc28_x86_64_01') {
      stage('Pre cleanup')

      { cleanWs() }

      stage('Buildtools checkout') {
      dir ('buildtools')

      { git changelog: false, poll: false, url: 'https://github.com/DOCGroup/MPC', shallow: true }

      }

      stage('Post cleanup')

      { cleanWs disableDeferredWipeout:true // cleanWs() }

      }

       

          [JENKINS-54225] Using disableDeferredWipeout within pipeline job results in no deleted workspace

          Johnny Willemsen created issue -
          Johnny Willemsen made changes -
          Environment New: wsCleanup 0.36 and Jenkins ver. 2.138.2
          Jenkins node is Fedora 28
          Johnny Willemsen made changes -
          Description Original: We are using pipeline and at the end of the pipeline we have a stage as below. We added the disableDeferredWipeout recently to make sure that all disk space of the workspace is reclaimed before the job ends. We now notice that the workspace is not deleted anymore, when we remove the disableDeferredWipeout the workspace directory is gone again. Have tried to find some logs but can't find anything.

          {{stage('Post cleanup') {}}

          {{step([$class: 'WsCleanup', disableDeferredWipeout: true])}}

          {{}}}

          In the log we only get the message below but at the end the workspace is still there

          {{[WS-CLEANUP] Deleting project workspace...}}
          {{[WS-CLEANUP] Deferred wipeout is disabled by the job configuration...}}
          {{[WS-CLEANUP] done}}
          New: We are using pipeline and at the end of the pipeline we have a stage as below. We added the disableDeferredWipeout recently to make sure that all disk space of the workspace is reclaimed before the job ends. We now notice that the workspace is not deleted anymore, when we remove the disableDeferredWipeout the workspace directory is gone again. Have tried to find some logs but can't find anything.

          {{stage('Post cleanup') {}}

          {{step([$class: 'WsCleanup', disableDeferredWipeout: true])}}

          {{}}}

          In the log we only get the message below but at the end the workspace is still there

          {{[WS-CLEANUP] Deleting project workspace...}}
           {{[WS-CLEANUP] Deferred wipeout is disabled by the job configuration...}}
           {{[WS-CLEANUP] done}}

           

          As reproducer you can use the pipeline job below, only adapt the node argument. After the pipeline job has finished we would expect to have an empty workspace but with disableDeferredWipeout:true the buildtools directory is still there, without the argument the workspace is deleted

          {{node('Scarab_fc28_x86_64_01') {}}
          {{  stage('Pre cleanup') {}}
          {{    cleanWs()}}
          {{  }}}
          {{  stage('Buildtools checkout') {}}
          {{    dir ('buildtools') {}}
          {{      git changelog: false, poll: false, url: 'https://github.com/DOCGroup/MPC', shallow: true}}
          {{    }}}
          {{  }}}
           
          {{ stage('Post cleanup') {}}
          {{ cleanWs disableDeferredWipeout:true}}
          {{// cleanWs()}}
          {{ }}}
          {{}}}
          Johnny Willemsen made changes -
          Description Original: We are using pipeline and at the end of the pipeline we have a stage as below. We added the disableDeferredWipeout recently to make sure that all disk space of the workspace is reclaimed before the job ends. We now notice that the workspace is not deleted anymore, when we remove the disableDeferredWipeout the workspace directory is gone again. Have tried to find some logs but can't find anything.

          {{stage('Post cleanup') {}}

          {{step([$class: 'WsCleanup', disableDeferredWipeout: true])}}

          {{}}}

          In the log we only get the message below but at the end the workspace is still there

          {{[WS-CLEANUP] Deleting project workspace...}}
           {{[WS-CLEANUP] Deferred wipeout is disabled by the job configuration...}}
           {{[WS-CLEANUP] done}}

           

          As reproducer you can use the pipeline job below, only adapt the node argument. After the pipeline job has finished we would expect to have an empty workspace but with disableDeferredWipeout:true the buildtools directory is still there, without the argument the workspace is deleted

          {{node('Scarab_fc28_x86_64_01') {}}
          {{  stage('Pre cleanup') {}}
          {{    cleanWs()}}
          {{  }}}
          {{  stage('Buildtools checkout') {}}
          {{    dir ('buildtools') {}}
          {{      git changelog: false, poll: false, url: 'https://github.com/DOCGroup/MPC', shallow: true}}
          {{    }}}
          {{  }}}
           
          {{ stage('Post cleanup') {}}
          {{ cleanWs disableDeferredWipeout:true}}
          {{// cleanWs()}}
          {{ }}}
          {{}}}
          New: We are using pipeline and at the end of the pipeline we have a stage as below. We added the disableDeferredWipeout recently to make sure that all disk space of the workspace is reclaimed before the job ends. We now notice that the workspace is not deleted anymore, when we remove the disableDeferredWipeout the workspace directory is gone again. Have tried to find some logs but can't find anything.

          {{stage('Post cleanup') {}}

          {{step([$class: 'WsCleanup', disableDeferredWipeout: true])}}

          {{}}}

          In the log we only get the message below but at the end the workspace is still there

          {{[WS-CLEANUP] Deleting project workspace...}}
           {{[WS-CLEANUP] Deferred wipeout is disabled by the job configuration...}}
           {{[WS-CLEANUP] done}}

           

          As reproducer you can use the pipeline job below, only adapt the node argument. After the pipeline job has finished we would expect to have an empty workspace but with disableDeferredWipeout:true the buildtools directory is still there, without the argument the workspace is deleted

          node('Scarab_fc28_x86_64_01') {
           stage('Pre cleanup') {
           cleanWs()
           }
           stage('Buildtools checkout') {
           dir ('buildtools') {
           git changelog: false, poll: false, url: 'https://github.com/DOCGroup/MPC', shallow: true
           }
           }
           
           stage('Post cleanup') {
           cleanWs disableDeferredWipeout:true
          // cleanWs()
           }
          }

           

          Adam Brousseau added a comment - - edited

          Also seeing this issue. Seems to leave behind the workspace (and .git folder) but the Git repository is "corrupt" so the next build will fail.

          Running shell script
          + git clean -ffxd
          fatal: Not a git repository (or any parent up to mount point /home/jenkins)
          Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

          Adam Brousseau added a comment - - edited Also seeing this issue. Seems to leave behind the workspace (and .git folder) but the Git repository is "corrupt" so the next build will fail. Running shell script + git clean -ffxd fatal: Not a git repository (or any parent up to mount point /home/jenkins) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
          Roufique Hossain made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Oliver Gondža made changes -
          Status Original: In Progress [ 3 ] New: Open [ 1 ]
          Oliver Gondža made changes -
          Assignee Original: Oliver Gondža [ olivergondza ] New: Pavel Janoušek [ pajasoft ]

          Pavel, can you please have a look? Thanks!

          Oliver Gondža added a comment - Pavel, can you please have a look? Thanks!

          Guys,
          thank you for your report of this issue.
          Unfortunately I've tried your reproducer or similar setup several times but no luck on my side - simply I can't reproduce your issue, everything works like charm with expected result - after job execution, the whole workspace is cleaned-up, only the system WORKSPACE directory (<location defined in node setup - "remoteFS">/workspace) itself remains.
          There is a major difference if deferred wipeout is used or not. If it is used, it's taken an improved version of cleaner made by ogondza, if not the legacy original cleaner is taken. The impl. of both is far different.

          My idea here is some kind of clashing with other plugin (like monitor, statistics etc.) on your instance which is manifested by the fact the directory is processed but erased only partially ("Git repo is corrupted" is my clue), if there remains at least one file, system refuses to delete the directory. The main difference during cleaning is the fact that the legacy cleaner is executed and it finishes before the run is completed but enhanced Wipeout (deferred) usually runs after the run finishes - something else blocks files to be erased in the first case.

          Pavel Janoušek added a comment - Guys, thank you for your report of this issue. Unfortunately I've tried your reproducer or similar setup several times but no luck on my side - simply I can't reproduce your issue, everything works like charm with expected result - after job execution, the whole workspace is cleaned-up, only the system WORKSPACE directory (<location defined in node setup - "remoteFS">/workspace) itself remains. There is a major difference if deferred wipeout is used or not. If it is used, it's taken an improved version of cleaner made by ogondza, if not the legacy original cleaner is taken. The impl. of both is far different. My idea here is some kind of clashing with other plugin (like monitor, statistics etc.) on your instance which is manifested by the fact the directory is processed but erased only partially ("Git repo is corrupted" is my clue), if there remains at least one file, system refuses to delete the directory. The main difference during cleaning is the fact that the legacy cleaner is executed and it finishes before the run is completed but enhanced Wipeout (deferred) usually runs after the run finishes - something else blocks files to be erased in the first case.

            pajasoft Pavel Janoušek
            jwillemsen Johnny Willemsen
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: