jenkins - 使用 deleteDir 的 Jenkins 管道“无法删除”
问题描述
我有一个詹金斯管道,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] }
解决方案
推荐阅读
- python - 如何从 HTML 中的该属性中提取字符串?
- mysql - SELECT /*!N SQL_NO_CACHE */ * FROM `table` - 这是什么?
- heroku - 我无法让 libvips 在 heroku 上编译
- c# - SetActive 的反应不同
- ghc - 堆栈如何确定使用哪个 ghc?
- javascript - 不确定我对 React Redux 应用程序中特定部分的处理方法?
- html - HTML 元素颜色、颜色和宽度 CSS 属性不起作用
- java - Jetty 中的 JSR-356 javax websockets(嵌入式和非嵌入式)
- matlab - 如何使用八度符号组合分数?
- swift - 如何仅获取 Swift4 中结构数组中每个唯一名称的最后一个值?