本文介绍了提交后挂钩失败(退出代码3)与输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用后提交脚本远程调用Jenkins作业。我目前通过Eclipse Kepler / Subversive / SVNKit连接器提交代码。



post-commit脚本:

 如果svnlook dirs-changed -r$ REV$ REPOS| grep -qEe'^ trunk /';那么
wget --post-data =job = APS-RemoteServerAction& token = SECRET& ACTION = deploy& ASSET_NAME = POST-COMMIT-TEST& DEPLOY_ENV = DEV& REVISION = $ REVhttp:// my .domain.com:8080 / buildByToken / buildWithParameters
fi

Eclipse的错误截图:





重要提示:




  • 浏览器指示新版本

  • 作业在Jenkins上运行,历史记录显示

  • 每次提交时,我收到此错误消息

  • 我尝试添加标志 - quiet ,但是我有相同的退出代码。



我认为这是由于wget和发布的价值?



编辑#1 p>

我想指出,我正在使用Jenkins 。我转而使用了一个POST,而不是一个GET(它的工作原理),因为最终会移动到https上,并将令牌保留在URL之外。

解决方案

我解释错误消息是指wget无法在其当前目录中写入名为 buildWithParameters 的文件。使用 wget -O - 将输出写入stdout。


I'm trying to call a Jenkins job remotely using a post-commit script. I'm currently committing code through Eclipse Kepler/Subversive/SVNKit Connector.

post-commit script:

if svnlook dirs-changed -r "$REV" "$REPOS" | grep -qEe '^trunk/'; then
  wget --post-data="job=APS-RemoteServerAction&token=SECRET&ACTION=deploy&ASSET_NAME=POST-COMMIT-TEST&DEPLOY_ENV=DEV&REVISION=$REV" "http://my.domain.com:8080/buildByToken/buildWithParameters"
fi

Screenshot of error through Eclipse:

Important notes:

  • Code does get committed properly, repository browser indicates a new version
  • The job runs on Jenkins, the history shows that
  • Everytime I commit, I get this error message
  • I tried adding the flag --quiet, but I got the same exit code.

I'm thinking it's due to wget and posting the values?

Edit #1

I would like to point out that I'm using the Jenkins Build Authorization Token Root Plugin. I switched to a POST instead of a GET (which works) due to eventually moving onto https and keeping the token out of the URL.

解决方案

I interpret the error message to mean that wget can not write a file with the name buildWithParameters in its current directory. Use wget -O - to write the output to stdout.

这篇关于提交后挂钩失败(退出代码3)与输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 22:55