显示警告 post-commit hook 失败(退出代码 255)且无输出

Showing warning post-commit hook failed (exit code 255) with no output

当我尝试提交到我的 svn 存储库时,出现如下错误:

warning post-commit hook failed(exit code 255) with no output

并且我在 home/repository/pipeline/hooks 目录中添加了我的 post-commit 文件。

我的 post-commit 挂钩文件如下所示:

#!/bin/sh
REPOS=""
REV=""
UUID=`svnlook uuid $REPOS`
/usr/bin/wget \
 --header "Content-Type:text/plain;charset=UTF-8" \
 --post-data "`svnlook changed --revision $REV $REPOS`" \
 --output-document "-" \
 --timeout=2 \
 http://<jenkins-Ip:port>/subversion/${UUID}/notifyCommit?rev=$REV

而我的svn安装目录是/usr/bin.

那么这与这种权限类型有关吗?我怎样才能找到这里的问题?

根据 SVN Book,post-commit 挂钩必须以 0 状态退出。所有 non-zero 状态都是错误,你的钩子(显然)不能正常工作,因为

anything that the hook printed to stderr will be marshalled back to the client, making it easier to diagnose hook failures

你必须 intercept stderr|stdout output 的 wget 并检查它

只是要注意:我想,你忘记了,钩子是在 空环境 和普通 svnlook uuid $REPOS return 中执行的(没有找到 svnlook它的完整路径)和生成 notifyCommit 的损坏路径