jenkin构建报错信息及解决方案

这篇具有很好参考价值的文章主要介绍了jenkin构建报错信息及解决方案。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

报错信息1:Exception when publishing, exception message

最近一直在做Jenkins项目,也经常会出现一些报错信息,今天在测试的时候出现了下面的报错信息,所以现在记录一下我的报错过程及解决方案。

...............省略部分内容........................
[JENKINS] Archiving /root/.jenkins/workspace/one_plus/target/easy-springmvc-maven.war to springmvc-maven/easy-springmvc-maven/0.0.1-SNAPSHOT/easy-springmvc-maven-0.0.1-SNAPSHOT.war
channel stopped
SSH: Connecting from host [bogon]
SSH: Connecting with configuration [test] ...
ERROR: Exception when publishing, exception message [Failed to connect and initialize SSH connection. Message: [Failed to connect session for config [test]. Message [java.net.NoRouteToHostException: 没有到主机的路由 (Host unreachable)]]]
Finished: UNSTABLE

原因及解决办法
在我思考并查找后发现原因是我的连接的后端服务器IP地址改变了,我之前用的地址是192.168.119.134,但是因为后端地址改变了没有更换所以连接不成功。
jenkin构建报错信息及解决方案

解决:更换为正确的地址测试成功,再次发送Jenkins服务器端的密钥

[root@bogon ~]# ssh-copy-id -i root@192.168.119.148

重新构建:成功
jenkin构建报错信息及解决方案

报错信息2:

Started by user jun
Running as SYSTEM
Building in workspace /root/.jenkins/workspace/test
The recommended git tool is: NONE
No credentials specified
Cloning the remote Git repository
Cloning repository https://gitee.com/yangge666a/testweb
 > git init /root/.jenkins/workspace/test # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Could not init /root/.jenkins/workspace/test
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:1049)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:802)
	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1225)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1308)
	at hudson.scm.SCM.checkout(SCM.java:540)
	at hudson.model.AbstractProject.checkout(AbstractProject.java:1217)
	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:647)
	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:519)
	at hudson.model.Run.execute(Run.java:1897)
	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
	at hudson.model.ResourceController.execute(ResourceController.java:101)
	at hudson.model.Executor.run(Executor.java:442)
Caused by: hudson.plugins.git.GitException: Error performing git command: git init /root/.jenkins/workspace/test
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2746)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2660)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2656)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1981)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:1047)
	... 12 more
Caused by: java.io.IOException: Cannot run program "git" (in directory "/root/.jenkins/workspace/test"): error=2, 没有那个文件或目录
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
	at hudson.Proc$LocalProc.<init>(Proc.java:254)
	at hudson.Proc$LocalProc.<init>(Proc.java:223)
	at hudson.Launcher$LocalLauncher.launch(Launcher.java:997)
	at hudson.Launcher$ProcStarter.start(Launcher.java:509)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2727)
	... 16 more
Caused by: java.io.IOException: error=2, 没有那个文件或目录
	at java.lang.UNIXProcess.forkAndExec(Native Method)
	at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
	at java.lang.ProcessImpl.start(ProcessImpl.java:134)
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
	... 21 more
ERROR: Error cloning remote repo 'origin'
Sending e-mails to: yolo_yi@163.com
Finished: FAILURE

解决方案:

java.io.IOException: Cannot run program “git” (in directory “/root/.jenkins/workspace/test”): error=2, 没有那个文件或目录,看了这句话说不能运行git项目,说明在jenkins服务器上没有安装git

在Jenkins服务器上做了以下操作

[root@localhost ]# yum -y install git

报错信息3:ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [127]]

...................前面信息太多省略........................
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:39 min
[INFO] Finished at: 2023-01-15T21:07:55+08:00
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving /root/.jenkins/workspace/test/pom.xml to springmvc-maven/easy-springmvc-maven/0.0.1-SNAPSHOT/easy-springmvc-maven-0.0.1-SNAPSHOT.pom
[JENKINS] Archiving /root/.jenkins/workspace/test/target/easy-springmvc-maven.war to springmvc-maven/easy-springmvc-maven/0.0.1-SNAPSHOT/easy-springmvc-maven-0.0.1-SNAPSHOT.war
SSH: Connecting from host [localhost]
SSH: Connecting with configuration [test162] ...
channel stopped
SSH: EXEC: completed after 214 ms
SSH: Disconnecting configuration [test162] ...
ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [127]]
Sending e-mails to: yolo_yi@163.com
Finished: UNSTABLE

原因:没有将脚本文件放在脚本目录下

我定义的:
jenkin构建报错信息及解决方案
但是我存放的错误:
jenkin构建报错信息及解决方案
再次构建成功:
jenkin构建报错信息及解决方案

报错信息4:

Started by user jun
Running as SYSTEM
Building in workspace /root/.jenkins/workspace/gitlab
The recommended git tool is: NONE
using credential 43d744f4-170f-426d-a34b-cccca19404b9
 > git rev-parse --resolve-git-dir /root/.jenkins/workspace/gitlab/.git # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url git@192.168.119.161:root/jenkins-for-gitlab.git # timeout=10
Fetching upstream changes from git@192.168.119.161:root/jenkins-for-gitlab.git
 > git --version # timeout=10
 > git --version # 'git version 1.8.3.1'
using GIT_SSH to set credentials gitlab
Verifying host key using known hosts file
 > git fetch --tags --progress git@192.168.119.161:root/jenkins-for-gitlab.git +refs/heads/*:refs/remotes/origin/* # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from git@192.168.119.161:root/jenkins-for-gitlab.git
	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:1002)
	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1244)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1308)
	at hudson.scm.SCM.checkout(SCM.java:540)
	at hudson.model.AbstractProject.checkout(AbstractProject.java:1217)
	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:647)
	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:519)
	at hudson.model.Run.execute(Run.java:1897)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
	at hudson.model.ResourceController.execute(ResourceController.java:101)
	at hudson.model.Executor.run(Executor.java:442)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress git@192.168.119.161:root/jenkins-for-gitlab.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: No ECDSA host key is known for 192.168.119.161 and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2734)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2111)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:87)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:623)
	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:1000)
	... 11 more
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE

出错原因:

stderr: No ECDSA host key is known for 192.168.119.161 and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.

通过这几行可以看出192.168.119.161没有被分发密钥,所以主机认证失败

解决:文章来源地址https://www.toymoban.com/news/detail-511079.html

##我们在Jenkins向gitlab分发密钥,再次构建
[root@localhost ~]#  ssh-copy-id -i root@192.168.119.161
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '192.168.119.161 (192.168.119.161)' can't be established.
ECDSA key fingerprint is SHA256:ntUPfvW1LRY8s42ot/wG2AlcFvtzgig3SJWTGLCnTLI.
ECDSA key fingerprint is MD5:5a:a0:c9:8a:24:63:fb:90:82:1f:d8:aa:4d:5d:67:2f.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.119.161's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@192.168.119.161'"
and check to make sure that only the key(s) you wanted were added.

[root@localhost ~]# ssh root@192.168.119.161
Last login: Sun Jan 15 21:26:00 2023 from 192.168.119.1
[root@localhost ~]# exit
登出
Connection to 192.168.119.161 closed.

到了这里,关于jenkin构建报错信息及解决方案的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Vite + Vue3 +Vant4构建项目时,按需引入使用Toast组件,引用 showToast 时出现编译报错的解决方案

    一.问题定位 在Vite + Vue3 +Vant4构建项目时,需要使用Toast组件显示提示信息,按照官方文档使用函数调用 使用后直接报错,说是找不到对应的样式文件(如下图): 在项目中查找node-moudles文件,确实没有找到,只有一个toast文件(如下图): 在百度搜索解决方法,说是需要单

    2024年01月17日
    浏览(50)
  • 【错误记录】Android 编译报错 ( Could not resolve xxx | 手动下载依赖库并进行本地配置 Gradle 依赖的解决方案 | 构建 Maven 依赖下载路径 )

    编译 Android Studio 项目时 , 报如下错误 , 下载依赖库失败 ; 报错信息 : 下面是 当前 Android 项目的 Gradle 配置中的 Maven 仓库 ; 其中使用 maven { url \\\"https://repo.spring.io/plugins-release/\\\" } 配置的 Maven 仓库就是对应的地址 ; 使用 google() 函数配置的 Maven 仓库地址 是 https://maven.google.com/ , 可

    2024年04月15日
    浏览(51)
  • Jenkins忘记密码解决方案

    配置一般在c盘的programData下 找到passwordHash块改为:passwordHash#jbcrypt:$2a$10$DdaWzN64JgUtLdvxWIflcuQu2fgrrMSAMabF5TSrGK5nXitqK9ZMS/passwordHash

    2024年02月12日
    浏览(40)
  • Jenkins 安装插件失败问题解决方案

    安装 jenkins 总是安装部分插件失败 1.切换下载源地址 1点击 \\\"系统管理\\\" - \\\"纠正\\\"  /  \\\"Manage Jenkins\\\" - \\\"Correct\\\" 2.点击 “高级\\\" / Advanced 3.找到页面最下面的 ”升级站点“ / Update Site ,替换链接为: ​​​​​https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json​​ 2.修改服务器

    2024年02月15日
    浏览(33)
  • CICD中的Jenkins和Ansible解决方案

    每一次重装系统或者是需要在服务器上正确运行软件,我们都需要重新安装所有的package、dependency并进行相应配置的微调。而这一过程可能就会因为疏忽导致错误,因此需要自动化部署 持续整合,持续交付(CI/CD)的实践,我们能够周期性的对产品进行各种专业测试,如果出

    2024年02月01日
    浏览(27)
  • # Jenkins:一键部署与备份的终极解决方案

    在持续集成和持续部署(CI/CD)的世界中,Jenkins 作为一个开源自动化服务器,扮演着至关重要的角色。但是,部署和维护 Jenkins 服务往往需要一定的技术知识和时间。这里介绍一个强大的工具—— Awesome-Jenkins ,它旨在简化 Jenkins 的部署和任务备份过程。 github地址:https://

    2024年01月19日
    浏览(40)
  • SkyEye与Jenkins的DevOps持续集成解决方案

    在技术飞速发展的当下,随着各行各业的软件逻辑复杂程度提升带来的需求变更,传统测试已无法满足与之相对应的一系列测试任务,有必要引入一个自动化、可持续集成构建的DevOps平台来解决此类问题。本文将主要介绍SkyEye与Jenkins的持续集成解决方案。 何谓DevOps?DevOps是

    2024年02月15日
    浏览(37)
  • 110页智慧农业解决方案(农业信息化解决方案)(ppt可编辑)

    本资料来源公开网络,仅供个人学习,请勿商用,如有侵权请联系删除。 第一部分 智慧农业概述 智慧农业以农业资源为基础、市场为导向、效益为中心、产业化为抓手,面向农业管理部门、农技推广部门、农业企业、农业园区和基地、农业专家、农民等多层次用户体系,充

    2023年04月21日
    浏览(32)
  • 『DevOps最佳实践』使用Jenkins和Harbor进行持续集成和交付的解决方案

    📣读完这篇文章里你能收获到 全文采用图文形式讲解 学会使用Harbor配置项目 学会在Jenkins中配置Harbor推送权限 使用Jenkins和Harbor进行持续集成的实践 感谢点赞+收藏,避免下次找不到~ 在现代软件开发中,自动化部署是提高效率和可靠性的关键。本文将带你深入探索如何使用

    2024年02月08日
    浏览(45)
  • 批量查询快递信息的最佳解决方案

    快递查询是我们日常生活中经常需要进行的操作,然而,当我们有多个快递单号需要查询时,逐个查询就显得非常繁琐和耗时。为了解决这个问题,今天给大家推荐一款实用的软件——【固乔快递查询助手】。 首先,在浏览器中搜索并下载【固乔快递查询助手】软件。该软件

    2024年02月14日
    浏览(40)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包