Jenkins安装以及错误排查

  • 系統:win10

一、安装

1、下载

Jenkins官网
在这里插入图片描述

2、安装

这里只介绍war包的安装方式
1、或者你可以用其他方法在命令行进入Jenkins的存放目录
在这里插入图片描述
2、命令行输入

java -jar jenkins.war

3、启动成功

在这里插入图片描述

4、直接打开浏览器输入http://localhost:8080

3、简单使用

二、问题排查

1、安装插件慢且失败率高

选择安装插件站点,任选其一

http://mirror.xmission.com/jenkins/updates/update-center.json   # 推荐
http://mirrors.shu.edu.cn/jenkins/updates/current/update-center.json
https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
http://updates.jenkins.io/update-center.json 

修改下面地址,重启即可
在这里插入图片描述

2、无法重启

当你在浏览器中输入:http://localhost:8080/restart会出现下面的提示信息。

Jenkins cannot restart itself as currently configured

(3)此时你需要“ Install as Windows service”

1、 系统设置:这里是引用
2、点击:Install as Windows service在这里插入图片描述
3、点击:install
在这里插入图片描述
设置好后重启Jenkins

3、Install as Windows service:失败

1、出现提示信息

AccessDenied

2、鼠标右键,选择属性在这里插入图片描述
3、兼容性:以管理员身份运行在这里插入图片描述

3、ModuleNotFoundError: No module named ‘XXX’

(1)、在脚本文件最上方添加如下代码


import sys
sys.path.append(r"D:\Workspaces\Pworkspace")

(2)、但是它不符合PEP8的代码规范,使用autopep8会将这两行代码放在所有引用的最下方,试过了不好使,会导致运行报错
在这里插入图片描述

4、configparser.NoSectionError: No section: ‘xxx’

(1)、类似这样使用相对路径的代码,也会报错,需要改成绝对路径

path = "../config/LocalElement.ini"
path = "D:/Workspaces/Pworkspace/config/LocalElement.ini"

5、感谢changyixue的博文

博文链接

发布了59 篇原创文章 · 获赞 6 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_27009225/article/details/104807816