0

While building jenkins job, jenkins pipeline unable to delete the files because of the below error same code working for other jobs. unable to figure out the problem . Why does jenkins pipeline causes these type of error. Can any one help me with this

ERROR: Failed to clean the workspace
jenkins.util.io.CompositeIOException: Unable to delete '/var/lib/jenkins/workspace/QSearch_RC'. Tried 3 times (of a maximum of 3) waiting 0.1 sec between attempts. (Discarded 112 additional exceptions)
    at jenkins.util.io.PathRemover.forceRemoveDirectoryContents(PathRemover.java:90)
    at hudson.Util.deleteContentsRecursive(Util.java:262)
    at hudson.Util.deleteContentsRecursive(Util.java:251)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:778)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1223)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1301)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:97)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:84)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:750)
    Suppressed: java.nio.file.AccessDeniedException: /var/lib/jenkins/workspace/QSearch_RC/build/hirl/qsrch.full.prod.SunOS5.10.WS12.0
        at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
        at sun.nio.fs.UnixFileAttributeViews$Posix.setMode(UnixFileAttributeViews.java:238)
        at sun.nio.fs.UnixFileAttributeViews$Posix.setPermissions(UnixFileAttributeViews.java:260)
        at java.nio.file.Files.setPosixFilePermissions(Files.java:2045)
        at jenkins.util.io.PathRemover.makeWritable(PathRemover.java:286)
        at jenkins.util.io.PathRemover.makeRemovable(PathRemover.java:259)
        at jenkins.util.io.PathRemover.removeOrMakeRemovableThenRemove(PathRemover.java:239)
        at jenkins.util.io.PathRemover.tryRemoveFile(PathRemover.java:205)
        at jenkins.util.io.PathRemover.tryRemoveRecursive(PathRemover.java:216)
        at jenkins.util.io.PathRemover.tryRemoveDirectoryContents(PathRemover.java:226)
        at jenkins.util.io.PathRemover.tryRemoveRecursive(PathRemover.java:215)
        at jenkins.util.io.PathRemover.tryRemoveDirectoryContents(PathRemover.java:226)
        at jenkins.util.io.PathRemover.tryRemoveRecursive(PathRemover.java:215)
        at jenkins.util.io.PathRemover.tryRemoveDirectoryContents(PathRemover.java:226)
        at jenkins.util.io.PathRemover.forceRemoveDirectoryContents(PathRemover.java:87)
        ... 14 more
    
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: Error cloning remote repo 'origin'
Finished: FAILURE

  1. Tried to build jenkins job 2.it failed due to above error
  • There seems to be a second exception which might give you a clue: `java.nio.file.AccessDeniedException`. Maybe Jenkins can't access this location? – M B Nov 08 '22 at 11:03
  • Is `build/hirl/qsrch.full.prod.SunOS5.10.WS12.0` generated by building project? If you build project in docker container and which is run as root, there is possible to lead the file owner is root, then the user on host has no access to delete it. Can you share your Jenkinsfile – yong Nov 17 '22 at 12:50

0 Answers0