Jenkins like Build Status Report Page?
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 c开发者_如何学运维onfidential....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)
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.
If you want to know how Jenkins/Hudson works, a good start is probably their Architecture Documents that were posted in January:
- Hudson Web/REST Architecture
- Hudson View Architecture
- Hudson Execution Architecture
- Hudson Remote Execution Architecture
- Hudson Security Architecture
- Hudson Plugin Architecture
If you want to look into how a simple continuous integration server works, you'd probably want to look at
- the source of travis-ci or
- the source of CI Joe
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.
精彩评论