我有一个詹金斯管道,最后有一个post
调用。看起来像这样:
post {
always {
deleteDir()
}
}
这是日志:
[Pipeline] { (Declarative: Post Actions)
[Pipeline] deleteDir
Error when executing always post condition:
java.io.IOException: Unable to delete '/var/jenkins_home/workspace/abide/.git/logs/refs/heads/master'. Tried 3 times (of a maximum of 3) waiting 0.1 sec between attempts.
at hudson.Util.deleteFile(Util.java:277)
at hudson.FilePath.deleteRecursive(FilePath.java:1322)
at hudson.FilePath.deleteContentsRecursive(FilePath.java:1331)
at hudson.FilePath.deleteRecursive(FilePath.java:1313)
at hudson.FilePath.deleteContentsRecursive(FilePath.java:1331)
at hudson.FilePath.deleteRecursive(FilePath.java:1313)
at hudson.FilePath.deleteContentsRecursive(FilePath.java:1331)
at hudson.FilePath.deleteRecursive(FilePath.java:1313)
at hudson.FilePath.deleteContentsRecursive(FilePath.java:1331)
at hudson.FilePath.deleteRecursive(FilePath.java:1313)
at hudson.FilePath.deleteContentsRecursive(FilePath.java:1331)
at hudson.FilePath.deleteRecursive(FilePath.java:1313)
at hudson.FilePath.access$1600(FilePath.java:209)
at hudson.FilePath$DeleteRecursive.invoke(FilePath.java:1291)
at hudson.FilePath$DeleteRecursive.invoke(FilePath.java:1287)
at hudson.FilePath.act(FilePath.java:1095)
at hudson.FilePath.act(FilePath.java:1078)
at hudson.FilePath.deleteRecursive(FilePath.java:1285)
at org.jenkinsci.plugins.workflow.steps.DeleteDirStep$Execution.run(DeleteDirStep.java:77)
at org.jenkinsci.plugins.workflow.steps.DeleteDirStep$Execution.run(DeleteDirStep.java:69)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:49)
at hudson.security.ACL.impersonate(ACL.java:290)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:46)
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:748)
Caused by: java.nio.file.FileSystemException: /var/jenkins_home/workspace/abide/.git/logs/refs/heads/master: Operation not permitted
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
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 hudson.Util.makeWritable(Util.java:337)
at hudson.Util.tryOnceDeleteFile(Util.java:297)
at hudson.Util.deleteFile(Util.java:272)
... 27 more
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
I found this post here, and nobody had a solution and it was missing the error so I am reposting.