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

DirectoryNotEmptyException when cleaning up after withCredentials/ZipFileBinding

XMLWordPrintable

      • Jenkins 1.633
      • credentials binding 1.5
      • credentials 1.24
      • workflow 1.10

      steps to reproduce

      1. upload a zip file to credentials as a secret file give it an ID of "myzip"
      2. create a workflow that references the above secret file
        node() {
              withCredentials([[$class: 'ZipFileBinding', credentialsId: 'myzip', variable: 'credentialsLocation']]) {
                sh 'THIS_SHOULD_FAIL_THE_BUILD'
              }
        }
        
      3. run the workflow

      expected results

      the workflow complets

      actual results

      the workflow fails with an exception removing the secret files (full stack in attached file)

      java.io.IOException: remote file operation failed: /scratch/jenkins/secretFiles/ed503d92-4726-4033-9afe-00affd88bde6 at hudson.remoting.Channel@25888a1:c1617b93: java.nio.file.DirectoryNotEmptyException: /scratch/jenkins/secretFiles/ed503d92-4726-4033-9afe-00affd88bde6/credentials.zip
      	at hudson.FilePath.act(FilePath.java:985)
      	at hudson.FilePath.act(FilePath.java:967)
      	at hudson.FilePath.deleteRecursive(FilePath.java:1169)
      	at org.jenkinsci.plugins.credentialsbinding.impl.FileBinding$UnbinderImpl.unbind(FileBinding.java:76)
      	at org.jenkinsci.plugins.credentialsbinding.impl.BindingStep$Callback.cleanup(BindingStep.java:176)
      	at org.jenkinsci.plugins.credentialsbinding.impl.BindingStep$Callback.onFailure(BindingStep.java:189)
      	at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$FailureAdapter.receive(CpsBodyExecution.java:294)
      	at com.cloudbees.groovy.cps.impl.ThrowBlock$1.receive(ThrowBlock.java:68)
      Caused by: java.nio.file.DirectoryNotEmptyException: /scratch/jenkins/secretFiles/ed503d92-4726-4033-9afe-00affd88bde6/credentials.zip
      	at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:242)
      	at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
      	at java.nio.file.Files.delete(Files.java:1079)
      

            Unassigned Unassigned
            teilo James Nord
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: