jenkins插件冲突解决以及版本升级

先来一张报错信息,真的是拉不到头。。
jenkins插件冲突解决以及版本升级_第1张图片

一、首先解决第一个问题,将插件下载地址换为国内源

jenkins插件冲突解决以及版本升级_第2张图片
官方源:https://updates.jenkins.io/update-center.json
国内源: https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/current/update-center.json
国内源2:http://mirror.xmission.com/jenkins/updates/update-center.json

修改配置文件

  • 进入jenkins安装目录下的/updates/default.json ,将其中的updates.jenkins-ci.org/download 替换为mirrors.tuna.tsinghua.edu.cn/jenkins ,
  • 有些 jenkins 版本当中,是将updates.jenkins.io/download 替换为mirrors.tuna.tsinghua.edu.cn/jenkins
  • 然后,把 www.google.com 修改为 www.baidu.com
sed -i 's#http://updates.jenkins-ci.org/download#https://mirrors.tuna.tsinghua.edu.cn/jenkins#g' default.json
sed -i 's#http://www.google.com#https://www.baidu.com#g' default.json


重启jenkins

二、在解决插件安装问题的过程中,我发现我的jenkins版本过低了,导致安装的一些插件或者已安装的插件依赖的插件不兼容,所以第二个问题,升级jenkins

我这里是用docker安装的jenkins,安装可以看我之前的文章,所以要先进到jenkins容器

# 进到jenkins.war文件所在的目录
root@456fcdc45cdf:/var/jenkins_home# cd /usr/share/jenkins/
root@456fcdc45cdf:/usr/share/jenkins# ls
jenkins.war  ref
root@456fcdc45cdf:/usr/share/jenkins#
root@456fcdc45cdf:/usr/share/jenkins#
root@456fcdc45cdf:/usr/share/jenkins#
# 备份原war包
root@456fcdc45cdf:/usr/share/jenkins# cp jenkins.war jenkins.war.2.328.bak
root@456fcdc45cdf:/usr/share/jenkins#
root@456fcdc45cdf:/usr/share/jenkins#
root@456fcdc45cdf:/usr/share/jenkins#
root@456fcdc45cdf:/usr/share/jenkins#
root@456fcdc45cdf:/usr/share/jenkins#
root@456fcdc45cdf:/usr/share/jenkins# ls
jenkins.war  jenkins.war.2.328.bak  ref
# 新建文件夹,存储新的war包
root@456fcdc45cdf:/usr/share/jenkins# mkdir other-version
root@456fcdc45cdf:/usr/share/jenkins# cd other-version/
# 下载最新的war包
root@456fcdc45cdf:/usr/share/jenkins/other-version# wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war

root@456fcdc45cdf:/usr/share/jenkins# ls
jenkins.war  jenkins.war.2.328.bak  other-version  ref
# 删除原war包
root@456fcdc45cdf:/usr/share/jenkins# rm jenkins.war
root@456fcdc45cdf:/usr/share/jenkins# ls
jenkins.war.2.328.bak  other-version  ref
root@456fcdc45cdf:/usr/share/jenkins#
root@456fcdc45cdf:/usr/share/jenkins#
root@456fcdc45cdf:/usr/share/jenkins# cd other-version/
# 替换war包
root@456fcdc45cdf:/usr/share/jenkins/other-version# mv jenkins.war ../
root@456fcdc45cdf:/usr/share/jenkins/other-version#
root@456fcdc45cdf:/usr/share/jenkins/other-version#
root@456fcdc45cdf:/usr/share/jenkins/other-version# ls
root@456fcdc45cdf:/usr/share/jenkins/other-version# cd ..
root@456fcdc45cdf:/usr/share/jenkins# ls
jenkins.war  jenkins.war.2.328.bak  other-version  ref
root@456fcdc45cdf:/usr/share/jenkins#
# 退出容器
root@456fcdc45cdf:/usr/share/jenkins# exit
[root@qa work]#
# 重启
[root@qa work]# docker restart jenkins
jenkins

jenkins下载官网:https://www.jenkins.io/download/
下载最新版本链接:http://mirrors.jenkins.io/war-stable/latest/jenkins.war
所有的war包地址:https://mirrors.tuna.tsinghua.edu.cn/jenkins/war/

三、替换jenkins.war文件后docker镜像文件无法启动解决方法

  777  docker ps -a
  778  docker cp 456f:/usr/share/jenkins/jenkins.war ./
  779  ll
  780  docker cp 456f:/usr/share/jenkins/jenkins.war.2.328.bak ./
  781  ll
  782  rm -rf jenkins.war
  783  mv jenkins.war.2.328.bak jenkins.war
  784  docker cp ./jenkins.war 456f:/usr/share/jenkins/jenkins.war
  785  docker start 456f
  786  docker ps

  795  ll
  796  docker ps
  797  docekr logs -f 456f
  798  docker logs -f 456f
  799  ll
  800  mv jenkins.war jenkins.war.2.328.bak
  801  docker exec -it 456f bash
  802  docker exec -it 456f -u root /bin/bash
  803  docker exec -it jenkins -u root /bin/bash
  804  rz
  805  docker ps
  806  docker cp ./jenkins.war 456f:usr/share/jenkins
  807  docker restart 456f
  808  docekr ps
  809  docker ps
  810  docker logs -f 456f
  811  history

修复问题后截图
注:因更换了war文件,ssh凭证和java-web文件都需要重新更换,更换后重新启动即可
jenkins插件冲突解决以及版本升级_第3张图片

你可能感兴趣的:(CI/CD,jenkins,运维)