jenkins - 无法删除 Jenkins 作业或构建
问题描述
我正在尝试通过远程访问 api 删除 Jenkins 作业。我正在通过我的代码使用以下 url 进行 POST 请求。通过 UI 手动删除会产生相同的错误。
https://JENKINS-URL.com/automationJob/doDelete。
POST 请求成功。但由于此错误,我无法删除作业
据我分析,我的构建中的 .nfs 文件正在阻止删除 ..nfs 文件是由于一些打开的进程而创建的。我无权访问 Jenkins-CLI 或 ssh 权限来检查哪个进程保留了 .nfs 文件。那么有人可以指出我正确的方向吗?就像我们可以执行一些 POST-BUILD Shell 命令来关闭所有进程或删除打开的 .nfs 文件一样。
堆栈跟踪:
java.nio.file.FileSystemException: /var/lib/jenkins/jobs/automationJob20181123161800281/builds/2/.nfs00000000023b265100000908: Device or resource busy
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.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:244)
at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
at java.nio.file.Files.deleteIfExists(Files.java:1165)
at hudson.Util.tryOnceDeleteFile(Util.java:290)
at hudson.Util.tryOnceDeleteRecursive(Util.java:370)
at hudson.Util.tryOnceDeleteContentsRecursive(Util.java:389)
at hudson.Util.tryOnceDeleteRecursive(Util.java:369)
at hudson.Util.tryOnceDeleteContentsRecursive(Util.java:389)
at hudson.Util.tryOnceDeleteRecursive(Util.java:369)
at hudson.Util.tryOnceDeleteContentsRecursive(Util.java:389)
at hudson.Util.tryOnceDeleteRecursive(Util.java:369)
at hudson.Util.deleteRecursive(Util.java:347)
Caused: java.io.IOException: Unable to delete '/var/lib/jenkins/jobs/automationJob20181123161800281'. Tried 3 times (of a maximum of 3) waiting 0.1 sec between attempts.
at hudson.Util.deleteRecursive(Util.java:352)
at hudson.model.AbstractItem.performDelete(AbstractItem.java:691)
at hudson.model.AbstractProject.performDelete(AbstractProject.java:362)
at hudson.model.AbstractItem.delete(AbstractItem.java:675)
at hudson.model.Job.delete(Job.java:674)
at hudson.model.AbstractItem.doDoDelete(AbstractItem.java:545)
at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:52)
at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
解决方案
推荐阅读
- javascript - 当它深深嵌套在 JavaScript 中时,如何将整个对象作为输出?
- google-chrome - 如何使用 Puppeteer API 呈现特殊字符
- c# - 如何根据窗口大小调整元素大小
- django - CharField 不保存
- nlp - 使用 OpenIE 从命令行中提取三元组
- mysql - MySQL - 具有非聚合列的 COUNT()
- javascript - 如何将数据添加到 React 的 props
- python - 向字典中添加多个键(python)
- c# - 使用非托管导出将字符串从 C# 返回到 C++ 返回数字
- c++ - 文件存在时,最新检查声称构建输入“丢失”