Jenkins 喜欢构建状态报告页面吗?
有点随意的问题,但我们公司使用 Jenkins http://jenkins-ci.org/
无论如何,我们公司有一个部分,就像“天气预报” ”以构建状态表的形式。基本上它会有一个天气图标(晴天/阴天/雷暴),然后在鼠标悬停时它会告诉您已覆盖的方法的百分比,以及有多少构建失败(例如 2/256)或其他内容。
还有一个蓝色发光指示器......当项目正在“构建”时闪烁/发光,并在项目完成时变成稳定的蓝色......无论如何,这到底是如何完成的?
显然,该网页是一些基本的 Html/Javascript,我非常确定 XML(用于表格)。东西,但是......我对如何像他们一样获得构建的状态感到困惑(特别是检查方法完成的百分比是多少?)。检查当前是否正在“构建”或已完成某些内容(我想它会返回一些“SUCCESS”字符串......当它完成时,但是当它当前正在构建时呢......
任何想法这是如何完成的?(b4有人问“你为什么不问公司”)我宁愿弄清楚如何在测试网站中自己实现它,
我会截图。 ..但我很确定大多数内容都被认为是机密......而且我不想被解雇,哈哈。但是 TL;DR 您将如何制作自己的构建状态检查器
编辑:http://wiki.jenkins-ci.org/display/JENKINS/Firefox+Add-on +Build+Monitor
^^ 这是一个 firefox 插件的示例,它可以实现我正在寻找的功能,但我想创建自己的插件而不是使用 jenkins( 这很棒,但我只是想弄清楚如何他们做到了)
Kinda a random question, but our company uses Jenkins
http://jenkins-ci.org/
Anyways there is a section for our company thats like a "Weather Report" in table form of build statuses. Basically It'll have a Weather Icon (Sunny/Cloudy/Thunderstorm) then on mouseover it'll tell what % of methods have been covered, and how many builds have failed (like 2/256) or something.
Also there is a Blue Glowing Indicator that well.....flashes/glows when a Project is being 'built' and turns solid blue when it is completed......Anyways How exactly is this done?
Obviously the webpage is some basic Html/Javascript and im pretty sure XML (for the tables). stuff, but....Im confused at how exactly you'd get the status of builds like they do, (especially checking what % of methods are completed?). And what about checking if something is currently being "built" or is completed (i'd imagine it returns some "SUCCESS" string.....when it's finished, but what about when it's being currently build....
Any ideas at how this is done? (and b4 someone asks "Why don't you ask the company") i'd rather just figure out how the basics are done to implement it myself in a test website.
I would take a screenshot....but im pretty sure most of stuff is considered confidential....and I wouldn't wanna get fired lol. But TL;DR How would you make your OWN build status checker.
EDIT: http://wiki.jenkins-ci.org/display/JENKINS/Firefox+Add-on+Build+Monitor
^^ thats a example of a firefox addon that sorta does what Im looking for, but I would want to create my own and not use jenkins( which is awesome, but I just want to figure out how they did it)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
状态页面中的 JavaScript。
简单版本将使用回调每隔 X 秒运行一次,以使用类似 http://api.jquery.com/jQuery.ajax/,然后相应地更新页面。
更高级的版本可以避免每 X 秒轮询一次,可以使用 Comet http:// /en.wikipedia.org/wiki/Comet_(programming)) 这将允许浏览器保持连接打开,并让服务器在更新发生时发送更新。
Jenkins 中的完成百分比基本上只是根据当前构建运行的时间与最近构建完成所需时间的猜测,因此假设您的服务器端跟踪任务的长度,您可以取平均值,并比较长度当前运行的百分比来计算完成百分比。
Javascript in the status page.
The simple version would use a call back to run every X number of seconds to request status information from the server with something like http://api.jquery.com/jQuery.ajax/, and then update the page accordingly.
A more advanced version, which avoids the need to poll every X seconds, would use something like Comet http://en.wikipedia.org/wiki/Comet_(programming)) which would allow the browser to keep a connection open, and for the server to send updates as they occurred.
The percent completion in Jenkins is just basically a guess based on how long the current build has been running vs how long recent builds took to complete, so assuming your server side tracks the length of tasks, you could take an average, and compare the length of the current run to calculate the percentage complete.
如果你想知道 Jenkins/Hudson 是如何工作的,一个好的开始可能是 他们的一月份发布的架构文档:
如果您想了解简单持续集成服务器的工作原理,您可能需要查看
既简单又用 Ruby 编写。
至于 jenkins 的实时状态指示器,请装备 Firebug 并在状态页面上查看。您应该看到一堆正在进行的 Ajax 请求。
对于构建进度估计部分(我认为这就是你所说的“检查已完成的方法的百分比”的意思,不是吗?)我观察到 Jenkins 只是通过关联此构建所花费的时间/上次所花费的时间来猜测运行此构建。
If you want to know how Jenkins/Hudson works, a good start is probably their Architecture Documents that were posted in January:
If you want to look into how a simple continuous integration server works, you'd probably want to look at
which are both simplistic and written in Ruby.
As for the live status indicator thingy with jenkins, equip yourself with Firebug and have a look around on the status page. You should see a bunch of Ajax requests going on.
For the build progress estimation part (I think that's what you mean by "checking what % of methods are completed", not?) I observed that Jenkins is just guessing that by relating time spent on this build / time spent on last run of this build.