Post-在 Windows 上接收 hooks 和 Jenkins
Post-receive hooks and Jenkins on Windows
我遇到了 post-接收挂钩和 Jenkins 集成的问题。
我在 GIT-repository 的挂钩目录中添加了一个名为 post-receive 的文件。文件内容为:
#!C:/Program\ Files/Git/usr/bin/sh.exe
echo "Post-receive started..."
curl.exe --user Jakob:tempPassword --url "http://localhost:8080/job/TestJob/build?token=ebcc64cb8315211c5287b20b3fdd7190"
echo "Post-receive ended..."
在 Jenkins 方面,我有一份关于此令牌的工作。
我是 运行 Jenkins 和 GIT-repos 在 Windows 10 机器上。
现在进入正题。如果我在 git bash shell 中本地执行上述命令,则所有内容都会执行并启动 Jenkins 构建。一切都很好。
如果我 commit/push 向 GIT-repo 发送一些内容,我可以看到 post-receive-hook 已执行(正如我在 tortoisegit window), 但是jenkins作业没有执行!
可能是什么问题?
我已经为此苦苦挣扎了两天,在发布我的问题后我找到了解决方案。我重新配置 Jenkins 以使用机器中 NIC 的 ip 地址(而不是我使用的 localhost,例如 192.168.1.55)并将 sh-script 更新为:
#!C:/Program\ Files/Git/usr/bin/sh.exe
echo "Post-receive started..."
curl.exe --user Jakob:tempPassword --url "http://192.168.1.55:8080/job/TestJob/build?token=ebcc64cb8315211c5287b20b3fdd7190"
echo "Post-receive ended..."
现在一切正常!
我遇到了 post-接收挂钩和 Jenkins 集成的问题。 我在 GIT-repository 的挂钩目录中添加了一个名为 post-receive 的文件。文件内容为:
#!C:/Program\ Files/Git/usr/bin/sh.exe
echo "Post-receive started..."
curl.exe --user Jakob:tempPassword --url "http://localhost:8080/job/TestJob/build?token=ebcc64cb8315211c5287b20b3fdd7190"
echo "Post-receive ended..."
在 Jenkins 方面,我有一份关于此令牌的工作。 我是 运行 Jenkins 和 GIT-repos 在 Windows 10 机器上。
现在进入正题。如果我在 git bash shell 中本地执行上述命令,则所有内容都会执行并启动 Jenkins 构建。一切都很好。
如果我 commit/push 向 GIT-repo 发送一些内容,我可以看到 post-receive-hook 已执行(正如我在 tortoisegit window), 但是jenkins作业没有执行!
可能是什么问题?
我已经为此苦苦挣扎了两天,在发布我的问题后我找到了解决方案。我重新配置 Jenkins 以使用机器中 NIC 的 ip 地址(而不是我使用的 localhost,例如 192.168.1.55)并将 sh-script 更新为:
#!C:/Program\ Files/Git/usr/bin/sh.exe
echo "Post-receive started..."
curl.exe --user Jakob:tempPassword --url "http://192.168.1.55:8080/job/TestJob/build?token=ebcc64cb8315211c5287b20b3fdd7190"
echo "Post-receive ended..."
现在一切正常!