docker jenkins 安装插件导致jenkins升级版本回退

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker jenkins 安装插件导致jenkins升级版本回退相关的知识,希望对你有一定的参考价值。

1、场景

同事要使用api token插件导致jenkins自动升级无法正常启动。jenkins属于sre的CD部分,一挂无法发版,十万火急。升级后启动报错内容如下:

docker logs -f jenkins-id

//插件启动失败

SEVERE  h.model.UpdateCenter$DownloadJob#run: Failed to install jaxb
java.io.IOException: Failed to load: JAXB plugin (jaxb 2.3.7-1)
- Update required: JavaBeans Activation Framework (JAF) API (javax-activation-api 1.2.0-2) to be updated to 1.2.0-5 or higher
at hudson.PluginWrapper.resolvePluginDependencies(PluginWrapper.java:1018)
at hudson.PluginManager.dynamicLoad(PluginManager.java:926)
Caused: java.io.IOException: Failed to install jaxb plugin
at hudson.PluginManager.dynamicLoad(PluginManager.java:940)
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:2217)
Caused: java.io.IOException: Failed to dynamically deploy this plugin
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:2221)
at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1867)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:121)
at java.lang.Thread.run(Thread.java:748)

//jenkins需要jdk 11 或者 17

Jenkins requires Java versions [17, 11] but you are running with Java 1.8 from /opt/java/openjdk/jre
java.lang.UnsupportedClassVersionError: 52.0
at executable.Main.verifyJavaVersion(Main.java:145)
at executable.Main.main(Main.java:109)
Oct 31, 2022 7:20:00 AM executable.Main verifyJavaVersion
SEVERE: Running with Java class version 52, which is older than the Minimum required version 55. See https://jenkins.io/redirect/java-support/
java.lang.UnsupportedClassVersionError: 52.0
at executable.Main.verifyJavaVersion(Main.java:145)
at executable.Main.main(Main.java:109)

2、jenkins是特定的版本并且内置配置信息,最好的方法是还原至原来的版本。

思路: jenkins不论是docker还是war包启动名字为 jenkins.war,需要找到还原原来的版本

通过目录id反查服务

docker

3、启动jenkins

#重启
docker restart docker-jenkins-id
#查看状态
docker ps -a | grep jenkins | grep Up

 观察日志,不报错并且状态Up,不在restarting

以上是关于docker jenkins 安装插件导致jenkins升级版本回退的主要内容,如果未能解决你的问题,请参考以下文章

ubuntu 中安装jenkins,基于docker运行jenkins

Jenkins和Docker

Docker运行Jenkins

Centos7安装Jenkins

Centos7安装Jenkins

51-Jenkins-Periodic Backup插件实现Jenkins备份