温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Jenkins迁移jobs后项目构建出现java.nio.file.DirectoryNotEmpt

发布时间:2020-03-06 00:14:37 来源:网络 阅读:738 作者:Oxsyshell 栏目:建站服务器

1、首先说一下迁移过程
1)新环境部署Jenkins持续集成环境,这里不在详细说明安装过程;
2)直接把旧的Jenkins家目录下得jobs目录通过scp得方式进行传输到新得环境下;

迁移完成后启动新环境Jenkins服务,构建项目控制台输出如下:

Jenkins迁移jobs后项目构建出现java.nio.file.DirectoryNotEmpt

观察控制台输出到最后,项目是构建成功得,而且不影响运行。

2、错误原因
通过Google查找得知有人提交了这个issues,This started happening on a new Jenkins server that a teammate was trying to setup by cloning an existing one, and I found out that he used scp -r to copy the whole working tree and that resulted in the lastSuccessful and lastStable soft-links to get converted to physical directories. I guess Jenkins was trying to remove it like it is a file (which a soft-link is), but since it turned out to be a directory that is not empty, it is causing this exception. When you remove/rename these directories, it clears the path for Jenkins to recreate the soft-links thus solving the problem. 链接详情请移步到:https://issues.jenkins-ci.org/browse/JENKINS-21330
翻译如下:
这开始发生在一个新的Jenkins服务器上,队友试图通过克隆现有的服务器来设置,我发现他使用scp -r来复制整个工作树,这导致了lastSuccessful和lastStable软链接转换为物理目录。我猜Jenkins试图删除它,就像它是一个文件(软链接),但由于它原来是一个非空的目录,它导致了这个异常。当您删除/重命名这些目录时,它会清除Jenkins重新创建软链接的路径,从而解决问题。

3、解决问题
以上我们知道问题所在就很方便得解决问题了,首先登陆到新环境下,删除所有项目得 lastSuccessful 和 lastStable目录:

find jobs/ -type d \( -name "lastSuccessful" -o -name "lastStable" \)  -exec rm -rf {} \;

执行完成之后再次构建项目就不会再出现以上异常了。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI