Jenkins JSON 结果构建请求
我正在寻找一种通过调用返回 JSON 的 url 来请求构建请求的方法,以便我能够使用 git 设置一个钩子,以便在每次推送到远程存储库后验证单元测试。我发现网址看起来像我想要的,所以我尝试了:
http://www.doamin.com:8082/job/bare-bone-test/build/api/json
但是当我尝试在浏览器中执行此操作时,我得到了
Firefox 检测到服务器正在重定向请求 这个地址以一种永远不会完成的方式
即使它确实触发了该作业的构建, 。这是请求将返回 JSON 响应的构建的正确方法吗?
I was looking for a way to request a build request through calling a url that would return JSON so that I would be able to setup a hook with git to validate unit tests after each push to the remote repository. I found url that looked like what I want so I tried:
http://www.doamin.com:8082/job/bare-bone-test/build/api/json
however when I try to do there in my browser I get the
Firefox has detected that the server is redirecting the request for
this address in a way that will never complete
even though it does trigger a build of that job. Is this the correct way to request a build that will return a JSON response?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据文档:
我不太确定
TOKEN
字段是否真的有必要。我能够使用简单的 get to the job//build URL 来启动构建:对于 git post-commit 挂钩,这应该足够了。
重定向,什么鬼?
您看到无限重定向问题的原因是
build/api/json
URL 重定向到build/api
端点(我认为build/api/json
的处理程序>build url 尝试通过截掉 URL 的最后一部分来重定向回作业状态页面)。由于某些奇怪的原因,build/api
重定向回自身。我认为构建不支持api/json
后缀,但如上所示,不需要它。According to the documentation:
I'm not quite sure if the
TOKEN
field is really necessary. I was able to kick off a build using a simple get to the job//build URL:For a git post-commit hook, this should be enough.
Redirect, wtf?
The reason you're seeing the infinite redirect issue, is that the
build/api/json
URL redirects to thebuild/api
endpoint (I think the handler for thebuild
url tries to redirect back to the job status page by chopping off the last part of the URL). For some strange reason,build/api
redirects back to itself. I don't think that the build supports theapi/json
suffix, but as shown above, it isn't needed.