1、更新插件替换为国内镜像插件源

替换原因:进入 Manage Jenkins -》 Manage Plugin,发现Updates tab页没数据,报There were errors checking the update sites: SocketTimeoutException: connect timed out错误(连接更新插件源超时)

Jenkins常见问题解决_git

 

 

问题分析:首先切换到Advanced tab页,Advanced tab页最下面有 Update Site 设置,看下当前Jenkins服务配置的更新插件源为:https://updates.jenkins.io/update-center.json,然后ssh到Jenkins服务所在服务器,验证此服务器是否能连通当前配置的更新插件源,经测试网络不通。

Jenkins常见问题解决_Jenkins_02

解决方案:将更新插件源替换为替换为服务器节点能够连通的国内插件源:

https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json

或者:

http://mirror.xmission.com/jenkins/updates/update-center.json

修改完后可以点击Submit按钮,然后点击Check now检查下,如果能重启Jenkins服务的话点击Submit按钮后可以直接重启下Jenkins服务。 

2、maven流水线构建报以下错误

+ mvn clean deploy
Error: missing `server' JVM at `/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.i386/jre/lib/i386/server/libjvm.so'.
Please install or use the JRE or JDK that contains these missing components.
script returned exit code 4

据项目组开发人员反馈,上午流水线任务构建还正常,下午流水线构建就报上面错误了,期间并没有修改过流水线配置、源码里面并没调整过JDK版本相关内容。

解决思路:经排查Jenkins Pod运行正常,maven打包容器也能拉取源码,只不过执行mvn命令时报错,所以基本可以排除Jenkins组件问题,于是网上搜索类似问题,找到类似问题文章:

adcfgclone.pl Error: missing `server' JVM at libjvm.so。

Jenkins常见问题解决_java_03

于是ssh到流水线打包节点,经排查操作系统正好是centos7.x,docker数据盘目录挂载的数据盘文件系统格式正是XFS,切挂载点超过了1T。

Jenkins常见问题解决_java_04

 解决方案:修改容器云打包节点到docker数据盘<1T的节点上,至此问题解决。

3、解决Jenkins流水线任务拉取代码报git config File exists错误

错误信息:

returned status code 255:
stdout: 
stderr: error: could not lock config file .git/config: File exists

	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2450)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2380)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2376)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1923)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1935)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.setRemoteUrl(CliGitAPIImpl.java:1549)
	at hudson.plugins.git.GitAPI.setRemoteUrl(GitAPI.java:161)
	at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:357)
	at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:330)
	at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:396)
	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:582)
	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:100)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:310)
	at hudson.model.ResourceController.execute(ResourceController.java:99)
	at hudson.model.Executor.run(Executor.java:432)
Finished: FAILURE

解决方案:

到Jenkins数据目录查找,可以发现在Jenkins安装目录下有个caches目录

/var/jenkins_home/caches/git-762b1469bb9de7658adbaec8d8b12877/.git/config
......
/var/jenkins_home/caches/git-6dff59f087b2f03588f3905a47012c3c/.git/config
/var/jenkins_home/caches/git-259c3ec0c808380e583d66552ba73d06/.git/config
/var/jenkins_home/caches/git-08f22672d5e50dba23f07dcd52f3100d/.git/config
/var/jenkins_home/caches/git-ee60fb5e6f1859e7ee4717f127258a34/.git/config
/var/jenkins_home/.config/jgit/config

在某个git-xxx目录里面有.git/config文件和.git/config.lock文件,删除config.lock文件即可  

find / -name "config.lock" -type f
rm xxx.xxx/config.lock

参考:https://www.jianshu.com/p/05c42cc80cad

4、maven流水线构建报unable to allocate file descriptoe table - out of ....错误

错误信息:

Jenkins常见问题解决_java_05

解决方案:

1)先检查Jenkins打包节点文件句柄数配置

ulimit -n

如果值过小,通过以下命令进行配置

ci节点配置limit:
echo "* soft nofile 65535" >>/etc/security/limits.conf
echo "* hard nofile 65535" >>/etc/security/limits.conf
ulimit -n 65535

注意:通过配置文件句柄数解决以上错误详细原因参见《Linux Socket》。

2)检查Jenkins打包节点docker服务句柄数配置

docker服务配置文件配置limit

/usr/lib/systemd/system/docker.service
--default-ulimit nofile=65535:65535

Jenkins常见问题解决_Jenkins_06

 重启docker服务

systemctl daemon-reload
systemctl restart docker