Jenkins发布时常见异常(持续更新...)

1. Exception when publishing, exception message [Exec exit status not zero. Status [126]

报错日志:

SSH: EXEC: STDOUT/STDERR from command [/app/***/publish.sh] ...
bash: /app/***/publish.sh: Permission denied
SSH: EXEC: completed after 200 ms
SSH: Disconnecting configuration [***] ...
ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [126]]
Build step 'Send build artifacts over SSH' changed build result to UNSTABLE
Finished: UNSTABLE

原因:
Jenkins调用的脚本文件权限不够

解决:
使用chmod增加权限

chmod 777 publish.sh

2. Exception when publishing, exception message [Exec exit status not zero. Status [127]]

报错日志:

SSH: EXEC: STDOUT/STDERR from command [/app/***/publish.sh] ...
bash: /app/***/publish.sh: No such file or directory
SSH: EXEC: completed after 200 ms
SSH: Disconnecting configuration [***] ...
ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [127]]
Build step 'Send build artifacts over SSH' changed build result to UNSTABLE
Finished: UNSTABLE

原因:

脚本文件目录错误

解决:

将Jenkins配置中的脚本目录地址改正确。
这里需要注意一下:当 SSH Server 中配置Remote Directory后,下图中的 Remote directory 填写相对地址;Exec command 填写绝对地址。
在这里插入图片描述

3. ERROR: Error cloning remote repo ‘origin’

报错日志:

Cloning the remote Git repository
Cloning repository http://****:3000/***/***.git
 > /usr/bin/git init /home/jenkins/workspace/*** # timeout=10
Fetching upstream changes from http://****:3000/***/***.git
 > /usr/bin/git --version # timeout=10
using GIT_ASKPASS to set credentials 
 > /usr/bin/git fetch --tags --progress http://****:3000/***/***.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --progress http://****:3000/***/***.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: fatal: unable to access 'http://****:3000/***/***.git/': The requested URL returned error: 500

	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2042)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1761)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$400(CliGitAPIImpl.java:72)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:442)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:655)
	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1152)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1192)
	at hudson.scm.SCM.checkout(SCM.java:504)
	at hudson.model.AbstractProject.checkout(AbstractProject.java:1208)
	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
	at hudson.model.Run.execute(Run.java:1810)
	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)
ERROR: Error cloning remote repo 'origin'
SSH: Current build result is [FAILURE], not going to run.
Finished: FAILURE

原因:
从描述信息来看,是无法拉取远程代码,之前明明是好正常的,怎么突然一下就不行了呢?那你想想,是不是最近负责这个项目的人离职了,O(∩_∩)O哈哈~
这个原因主要是 Git 用户被注销了,无法通过该用户获取 Git 代码。

解决:
从【配置】中,找到配置 Git 远程地址的地方,下图中会报红,将【Credentials】改成自己的用户就可以了。
在这里插入图片描述

4. ERROR: Exception when publishing, exception message [Failure]

报错日志:

Waiting for Jenkins to finish collecting data
[JENKINS] Archiving /home/jenkins/workspace/***/pom.xml to ***/***/0.0.1-SNAPSHOT/***-0.0.1-SNAPSHOT.pom
[JENKINS] Archiving /home/jenkins/workspace/***/target/***-0.0.1-SNAPSHOT.jar to ***/***/0.0.1-SNAPSHOT/***-0.0.1-SNAPSHOT.jar
channel stopped
SSH: Connecting from host [****]
SSH: Connecting with configuration [****] ...
SSH: Disconnecting configuration [****] ...
ERROR: Exception when publishing, exception message [Failure]
Build step 'Send build artifacts over SSH' changed build result to UNSTABLE
Finished: UNSTABLE

原因:

发生这个错误,一般是磁盘空间不足了,这种情况在测试环境比较常见(毕竟生产环境会有监控提醒的)!

解决:

查询磁盘使用情况命令:

df -h

使用删除文件命令,删掉多余日志:

rm -rf [指定文件]
  • 5
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

码农StayUp

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值