I've never known why Jenkins' "Build History" feature takes so long to 
generate its report on what was last run on a given build slave, but 
I've written a shell script to grab the data out of the XML files 
directly. It's not perfect, and it doesn't do "proper" XML parsing, but 
it works for me.

It's just a short shell script, the blurb is longer than the script:

http://steve-parker.org/code/sh/buildhistory/


 Jenkins' Build History feature tells you about what was built by a given 
server and when, along with various other information including the status 
of that build. For some reason, it takes it an incredibly long time to 
generate this report, causing proxy servers to time out waiting, and/or 
causing excessive CPU load on the Jenkins master, which really has better 
things to be doing than asking what ran where, and when.

Normally, all I am interested in is what jobs ran on a box, and whether or 
not they succeeded.

This simple script gets just that, and nothing else, by grepping the XML 
files directly. Okay, that's not the cleanest way to do it, but it works, 
it's simple, and it's likely to work in 99% of situations (or more).

It also colour-codes the output - successful builds are written in green 
and failed builds are in red. There are various other possible status 
(aborted, etc) which each get a different colour.

  Usage: buildhistory.sh [ -f ] slavename
    With the "-f" flag, output is ordered alphabetically by project name 
(marginally faster). 
    Without the "-f" flag, output is ordered by date (oldest first, most recent 
last).
    Exactly one slave name should be provided (the name may contain spaces).

License GPL version two <http://www.gnu.org/licenses/gpl-2.0.html> Download 
Here 
is a direct download link (.sh 
file)<http://steve-parker.org/code/sh/buildhistory/buildhistory.sh>
 | Plain text 
file<http://steve-parker.org/code/sh/buildhistory/buildhistory.sh.txt>
 | DOS-formatted text 
file<http://steve-parker.org/code/sh/buildhistory/buildhistory.txt> Sample 
Output 

[jenkins]$ ./buildhistory.sh buildslave23
Build history for Jenkins slave: buildslave23
Project                                  Date/Time       Status

foo-core-web-develop                     20140424.102620 = SUCCESS
foo-core-web-develop                     20140424.105233 = SUCCESS
foo-core-web-sonar-develop               20140424.105510 = SUCCESS
foo-core-web-develop                     20140424.122039 = SUCCESS
foo-core-sonar-develop                   20140424.130411 = FAILURE
foo-FeatureBranchSonarBuild              20140424.144020 = FAILURE
foo-FeatureBranchSonarBuild              20140424.155701 = ABORTED
foo-core-web-develop                     20140424.173555 = SUCCESS
foo-FeatureBranchSonarBuild              20140424.223123 = ABORTED
foo-core-web-develop                     20140425.075519 = SUCCESS
foo-core-sonar-develop                   20140425.100456 = ABORTED
foo-FeatureBranchBuild                   20140425.162209 = ABORTED
foo-FeatureBranchBuild                   20140425.165236 = FAILURE
foo-FeatureBranchBuild                   20140425.170210 = ABORTED
foo-FeatureBranchBuild                   20140425.190320 = ABORTED
foo-core-web-develop                     20140426.114928 = SUCCESS
foo-FeatureBranchBuild                   20140426.120027 = UNSTABLE
foo-core-web-develop                     20140428.083157 = SUCCESS
foo-FeatureBranchBuild                   20140428.083630 = UNSTABLE
foo-FeatureBranchBuild                   20140428.112322 = UNSTABLE
foo-web-FeatureBranchSonarBuild          20140428.115537 = SUCCESS
foo-FeatureBranchBuild                   20140428.131701 = UNSTABLE
[jenkins]$ 



Steve Parker

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to