Jenkins升级指南 LTS2.361.1

近期要在Jenkins中新增jacoco,对老旧Jenkins进行升级,碰到的一些问题汇总。

jenkins配置说明

  • 主目录,可在Configure System中查看,一般在:/var/lib/jenkins
  • war包目录,可在linux启动程序充查看,一般在:/usr/lib/jenkins
  • 系统服务脚本,我司在centos中安装运行,在/etc/rc.d/init.d/jenkins
  • jenkins日志,一般配置在/var/log/jenkins

服务脚本

#!/bin/sh
#
#     RedHat system statup script for Jenkins
#     Based on SUSE system statup script for Jenkins
#     Copyright (C) 2007  Pascal Bleser
#
#     This library is free software; you can redistribute it and/or modify it
#     under the terms of the GNU Lesser General Public License as published by
#     the Free Software Foundation; either version 2.1 of the License, or (at
#     your option) any later version.
#
#     This library is distributed in the hope that it will be useful, but
#     WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#     Lesser General Public License for more details.
#
#     You should have received a copy of the GNU Lesser General Public
#     License along with this library; if not, write to the Free Software
#     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
#     USA.
#
###############################################################################
#
# chkconfig: 35 99 01
# description: Jenkins Automation Server
#
###############################################################################
### BEGIN INIT INFO
# Provides:          jenkins
# Required-Start:    $local_fs $remote_fs $network $time $named
# Should-Start: $time sendmail
# Required-Stop:     $local_fs $remote_fs $network $time $named
# Should-Stop: $time sendmail
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: Jenkins Automation Server
# Description:       Jenkins Automation Server
### END INIT INFO# Check for missing binaries (stale symlinks should not happen)
JENKINS_WAR="/usr/lib/jenkins/jenkins.war"
test -r "$JENKINS_WAR" || { echo "$JENKINS_WAR not installed";if [ "$1" = "stop" ]; then exit 0;else exit 5; fi; }# Check for existence of needed config file and read it
JENKINS_CONFIG=/etc/sysconfig/jenkins
test -e "$JENKINS_CONFIG" || { echo "$JENKINS_CONFIG not existing";if [ "$1" = "stop" ]; then exit 0;else exit 6; fi; }
test -r "$JENKINS_CONFIG" || { echo "$JENKINS_CONFIG not readable. Perhaps you forgot 'sudo'?";if [ "$1" = "stop" ]; then exit 0;else exit 6; fi; }JENKINS_PID_FILE="/var/run/jenkins.pid"
JENKINS_LOCKFILE="/var/lock/subsys/jenkins"# Source function library.
. /etc/init.d/functions# Read config
[ -f "$JENKINS_CONFIG" ] && . "$JENKINS_CONFIG"# Set up environment accordingly to the configuration settings
[ -n "$JENKINS_HOME" ] || { echo "JENKINS_HOME not configured in $JENKINS_CONFIG";if [ "$1" = "stop" ]; then exit 0;else exit 6; fi; }
[ -d "$JENKINS_HOME" ] || { echo "JENKINS_HOME directory does not exist: $JENKINS_HOME";if [ "$1" = "stop" ]; then exit 0;else exit 1; fi; }# Search usable Java as /usr/bin/java might not point to minimal version required by Jenkins.
# see http://www.nabble.com/guinea-pigs-wanted-----Hudson-RPM-for-RedHat-Linux-td25673707.html
candidates="
/etc/alternatives/java
/usr/lib/jvm/java-1.8.0/bin/java
/usr/lib/jvm/jre-1.8.0/bin/java
/usr/lib/jvm/java-1.7.0/bin/java
/usr/lib/jvm/jre-1.7.0/bin/java
/usr/lib/jvm/java-11.0/bin/java
/usr/lib/jvm/jre-11.0/bin/java
/usr/lib/jvm/java-11-openjdk-amd64
/usr/bin/java
"
for candidate in $candidates
do[ -x "$JENKINS_JAVA_CMD" ] && breakJENKINS_JAVA_CMD="$candidate"
doneJAVA_CMD="$JENKINS_JAVA_CMD $JENKINS_JAVA_OPTIONS -DJENKINS_HOME=$JENKINS_HOME -jar $JENKINS_WAR"
PARAMS="--logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --daemon"
[ -n "$JENKINS_PORT" ] && PARAMS="$PARAMS --httpPort=$JENKINS_PORT"
[ -n "$JENKINS_LISTEN_ADDRESS" ] && PARAMS="$PARAMS --httpListenAddress=$JENKINS_LISTEN_ADDRESS"
[ -n "$JENKINS_HTTPS_PORT" ] && PARAMS="$PARAMS --httpsPort=$JENKINS_HTTPS_PORT"
[ -n "$JENKINS_HTTPS_KEYSTORE" ] && PARAMS="$PARAMS --httpsKeyStore=$JENKINS_HTTPS_KEYSTORE"
[ -n "$JENKINS_HTTPS_KEYSTORE_PASSWORD" ] && PARAMS="$PARAMS --httpsKeyStorePassword='$JENKINS_HTTPS_KEYSTORE_PASSWORD'"
[ -n "$JENKINS_HTTPS_LISTEN_ADDRESS" ] && PARAMS="$PARAMS --httpsListenAddress=$JENKINS_HTTPS_LISTEN_ADDRESS"
[ -n "$JENKINS_DEBUG_LEVEL" ] && PARAMS="$PARAMS --debug=$JENKINS_DEBUG_LEVEL"
[ -n "$JENKINS_HANDLER_STARTUP" ] && PARAMS="$PARAMS --handlerCountStartup=$JENKINS_HANDLER_STARTUP"
[ -n "$JENKINS_HANDLER_MAX" ] && PARAMS="$PARAMS --handlerCountMax=$JENKINS_HANDLER_MAX"
[ -n "$JENKINS_HANDLER_IDLE" ] && PARAMS="$PARAMS --handlerCountMaxIdle=$JENKINS_HANDLER_IDLE"
[ -n "$JENKINS_ARGS" ] && PARAMS="$PARAMS $JENKINS_ARGS"if [ "$JENKINS_ENABLE_ACCESS_LOG" = "yes" ]; thenPARAMS="$PARAMS --accessLoggerClassName=winstone.accesslog.SimpleAccessLogger --simpleAccessLogger.format=combined --simpleAccessLogger.file=/var/log/jenkins/access_log"
fiRETVAL=0case "$1" instart)echo -n "Starting Jenkins "daemon --user "$JENKINS_USER" --pidfile "$JENKINS_PID_FILE" $JAVA_CMD $PARAMS > /dev/nullRETVAL=$?if [ $RETVAL = 0 ]; thensuccessecho > "$JENKINS_PID_FILE"  # just in case we fail to find itMY_SESSION_ID=`/bin/ps h -o sess -p $$`# get PID/bin/ps hww -u "$JENKINS_USER" -o sess,ppid,pid,cmd | \while read sess ppid pid cmd; do[ "$ppid" = 1 ] || continue# this test doesn't work because Jenkins sets a new Session ID# [ "$sess" = "$MY_SESSION_ID" ] || continueecho "$cmd" | grep $JENKINS_WAR > /dev/null[ $? = 0 ] || continue# found a PIDecho $pid > "$JENKINS_PID_FILE"donetouch $JENKINS_LOCKFILEelsefailurefiecho;;stop)echo -n "Shutting down Jenkins "killproc jenkinsrm -f $JENKINS_LOCKFILERETVAL=$?echo;;try-restart|condrestart)if test "$1" = "condrestart"; thenecho "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"fi$0 statusif test $? = 0; then$0 restartelse: # Not running is not a failure.fi;;restart)$0 stop$0 start;;force-reload)echo -n "Reload service Jenkins "$0 try-restart;;reload)$0 restart;;status)status jenkinsRETVAL=$?;;probe)## Optional: Probe for the necessity of a reload, print out the## argument to this init script which is required for a reload.## Note: probe is not (yet) part of LSB (as of 1.9)test "$JENKINS_CONFIG" -nt "$JENKINS_PID_FILE" && echo reload;;*)echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"exit 1;;
esac
exit $RETVAL

升级说明

可根据服务脚本查看jenkins的一些信息,由于进行升级版本跨度比较大,最新版本不再支持JDK8,需要对JDK进行升级。

  1. 升级JDK:yum install java-11-openjdk-devel
  2. 停止jenkins运行:systemctl stop jenkins
  3. 下载最新LTS版本,War Packages,下载到服务器, 备份/usr/lib/jenkins/jenkins.war,并复制新版本到此处。(机场下更快)
  4. 可由启动脚本看到,会检测java,默认第一个为/etc/alternatives/java,所以升级JDK后需要配置升级后的JDK java:ln -snf /usr/lib/jvm/java-11-openjdk-11.0.19.0.7-1.el7_9.x86_64/bin/java /etc/alternatives/java
  5. 重启jenkins即可:systemctl start jenkins

升级后问题汇总

启动卡死,异常报错

异常如:

SEVERE  jenkins.model.Jenkins#save: An attempt to save Jenkins'' global configuration before it has been loaded has been made during milestone Configuration for all jobs updated.  This is indicative of a bug in the caller and may lead to full or partial loss of configuration.
java.lang.IllegalStateException: call traceSEVERE  jenkins.InitReactorRunner$1#onTaskFailed: Failed Finalizing set up
java.lang.IllegalStateException: An attempt to save the global configuration was made before it was loadedFailed to start LSB: Jenkins Automation ServerSEVERE winstone.Logger#logInternal: Container startup failed
java.io.FileNotFoundException: /var/cache/jenkins/war/

解决:

  1. 下载角色Role strategy hpi plugin文件,并将其放到JENKINS_HOME/plugins文件夹,即:/var/lib/jenkins/plugins/中。然后查看进程中是否还有jenkins,因为测试发现系统服务启动后卡死,强制退出进程还在,ps -ef | grep jenkins,查看进程号并强制杀掉kill -9 xx
  2. 还有部分权限问题:chown -R jenkins:jenkins /var/cache/jenkins/war/

顺利启动后,打开配置页面白屏,控制台报错

TypeError: Cannot read properties of undefined (reading 'hasClassName')
TypeError: Cannot read properties of undefined (reading 'getElementsBySelector')

解决:升级所有插件,重启jenkins可解决。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/2190.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

XML简介及操作

目录 1.XML简介 2.XML解析-DOM4J 1.XML简介 XML(EXtensible Markup Language),可扩展标记语言特点: XML与操作系统、编程语言的开发平台无关实现不同系统之间的数据交换作用: 数据交换配置应用程序和网站Ajax基石 HTML 与 XML …

python爬虫-获取headers(报文头)关键参数实例小记

注意!!!!某XX网站逆向实例仅作为学习案例,禁止其他个人以及团体做谋利用途!!! 第一步:请求页面,得到响应。建议首次请求时headers内容都带着,调试…

react报错信息

报错信息 render函数里dom不能直接展示obj对象 取变量记得要有{} https://segmentfault.com/q/1010000009619339 这样在写的时候就已经执行方法了,所以此处用箭头函数()》{}才会在点击时执行或者 遍历数据使用map来遍历,使用forea…

Docker【安装与基本使用】

【1】Docker的安装 注意:如果之前安装过docker其他版本,请删除干净。 docker-01 10.0.0.51 2G docker-02 10.0.0.52 2G docker-01 [rootdocker-01 ~]# cp -rp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime cp: overwrite ‘/etc/localtime’? …

如何查询企业诉讼信息?

如何免费查询企业诉讼信息? 企业的司法诉讼信息可以通过中国裁判文书网、中国执行信息公开网、中国庭审公告网去查询。 在这些网站上你可以通过输入企业名称或者注册号来查找相关的法律信息。大多数的法律诉讼信息都会在这些网站上公开,也会有一些特殊…

MyBatis代理开发:简化数据访问层(DAO)的实现

引言 在现代的应用程序开发中,数据访问层(DAO)是连接应用程序与数据库之间的关键组件。MyBatis是一个流行的Java持久层框架,提供了一种简化数据访问层开发的方法,即代理开发。本文将介绍MyBatis代理开发的概念和使用方…

H3C-Cloud Lab实验-OSPF配置实验

一、实验拓扑图 实验需求: 1、按照图示配置 IP 地址 2、按照图示分区域配置 OSPF ,实现全网互通 3、为了路由结构稳定,要求路由器使用环回口作为 Router-id,ABR 的环回口宣告进骨干区域 4、掌握OSPF初始化流程、路由表学习的过…

el-progress组件使用,样式修改,自定义文字

正常的el-progress显示是这样的 修改后 自动计算percentage&#xff0c;format自定义显示文字 <template><div><div class"content-view"><div v-for"(item, index) in progressList" class"item-view"><el-prog…

力扣算法数学类—Excel 表列序号

目录 Excel 表列序号 题解&#xff1a; 代码&#xff1a; Excel 表列序号 171. Excel 表列序号 - 力扣&#xff08;LeetCode&#xff09; 给你一个字符串 columnTitle &#xff0c;表示 Excel 表格中的列名称。返回 该列名称对应的列序号 。 例如&#xff1a; A -> 1 B -…

代理IP、Socks5代理和SK5代理的前沿技术与未来发展趋势

代理IP的前沿技术应用 人工智能与智能代理&#xff1a;结合人工智能技术&#xff0c;代理IP可以更加智能地处理网络请求和数据流&#xff0c;提高代理效率和准确性。区块链与去中心化代理&#xff1a;通过区块链技术&#xff0c;代理IP可以实现去中心化管理和身份验证&#xf…

解锁编程世界的魔法密码:探索算法的奥秘与应用

一个程序员一生中可能会邂逅各种各样的算法&#xff0c;但总有那么几种&#xff0c;是作为一个程序员一定会遇见且大概率需要掌握的算法。今天就来聊聊这些十分重要的“必抓&#xff01;”算法吧~* 一&#xff1a;引言 算法是解决问题和优化程序性能的核心&#xff0c;它是一…

你真的会用async和await么?

async函数搞懂 背景asyncawaitawait 知识点1await 知识点2await 知识点三await 知识点四await 知识点五 背景 背景就是遇到了一个比较烦人的模块&#xff0c;里面的涉及到了大量的async 和 awiat。发现大多人对这个语法糖一知半解&#xff0c;然后大量的滥用&#xff0c;整理一…

数据标注的类型有哪些?

构建像人类一样的AI或ML模型需要大量训练数据。要使模型做出决定并采取行动&#xff0c;就必须通过数据标注来训练模型&#xff0c;使其能够理解特定信息。 但是&#xff0c;什么是数据标注呢&#xff1f;数据标注是指对用于人工智能应用的数据进行分类和标注。我们必须针对特定…

Qt6 Qt Quick UI原型学习QML第二篇

Qt6 Qt Quick UI原型学习QML第二篇 界面效果QML语法语法讲解核心要素项目元素矩形元素文本元素图像元素MouseArea元素 界面效果 QML语法 import QtQuick 2.12 import QtQuick.Window 2.12Window {id: rootvisible: truewidth: 640height: 480title: qsTr("QML学习第二篇&…

用微服务架构推进企业数字化转型升级

随着数字化转型进入深水区&#xff0c;企业应用程序建设需求急剧增长且变化多端&#xff0c;软件架构经历了单体结构、垂直架构、SOA架构&#xff0c;发展到了现在的微服务架构。 单体架构目前应用较多&#xff0c;部署容易&#xff0c;但单体式应用内部包含了所有需要的服务&…

FPGA——点亮led灯

文章目录 一、实验环境二、实验任务三、实验过程3.1 编写verliog程序3.2 引脚配置 四、仿真4.1 仿真代码4.2仿真结果 五、实验结果六、总结 一、实验环境 quartus18.1 vscode Cyclone IV开发板 二、实验任务 每间隔1S实现led灯的亮灭&#xff0c;实现流水灯的效果。 三、实…

基于卡尔曼滤波进行四旋翼动力学建模(SimulinkMatlab)

&#x1f4a5;&#x1f4a5;&#x1f49e;&#x1f49e;欢迎来到本博客❤️❤️&#x1f4a5;&#x1f4a5; &#x1f3c6;博主优势&#xff1a;&#x1f31e;&#x1f31e;&#x1f31e;博客内容尽量做到思维缜密&#xff0c;逻辑清晰&#xff0c;为了方便读者。 ⛳️座右铭&a…

2.Docker镜像和容器操作

文章目录 Docker操作Docker镜像操作搜索镜像获取镜像镜像加速下载查看镜像详细信息为镜像添加标签删除镜像导出导入镜像上传镜像 Docker容器操作创建容器查看容器状态启动容器创建并启动容器进入容器停止容器删除容器复制容器文件到宿主机容器的导出导入 Docker操作 ###查看do…

vscode 端口转发实现端口映射,实现端口自由

用vscode连接server进行开发&#xff0c; 是非常方便的&#xff0c;但很多时候&#xff0c;server的端口开放的很有限&#xff0c;那么就可以利用vscode进行端口映射 举一个应用场景&#xff1a; 先通过A利用vscode 连接B&#xff0c;然后再vscode 的port窗口进行端口转发&…

phtyon读取pdf的远程地址解析内容

import xlwt,pymysql,requests,json,datetime,PyPDF2,urllib.request,io,ssl # 添加context 解决读取pdf时SSL报错问题 context ssl._create_unverified_context() # 读取pdf地址 获取pdf内容 req urllib.request.urlopen(contract_download_url,contextcontext) remo…