Parsing build logs

344 views
Skip to first unread message

Terry Hayes

unread,
Oct 24, 2012, 9:50:16 AM10/24/12
to jenkin...@googlegroups.com
I am trying to find/develop a plugin that will parse a set of build logs created by a build.  We are in the process of transitioning to Jenkins from an old proprietary build system that builds using a complex set of build scripts that run multi-threded builds that pipe output to separate files for separate commands.  I have read a lot of docs on Jenkins/plugins/java/jelly and have made up a couple simple plugins.

I found the "log parsing plugin" (https://wiki.jenkins-ci.org/display/JENKINS/Log+Parser+Plugin) for Jenkins and while it seems very useful for builds that run a set of commands in series that send their output to the console I need to be able to present a link to my users (similar to the way this plugin adds one for parsed console output) on the build web page that will take them to a page from which they can select the log they want.

I have done most of my coding in PERL and so the Jelly/Java/Javascript stuff in Jenkins is all new to me, as well as the general architecture for how Jenkins interfaces with plugins and the index.jelly files.

I have read a lot of documentation on Jenkins plugins but all of it seems to be pretty high level and low detail.  I have made a couple of my own and gotten them to do some simple stuff; but what I really need to know is how to add a new link to the page for any/every build (same place as the current "console output" link) that will take my user to a page where they can see log files for the associated build. 

I can probably figure out the logic for parsing and presenting those logs to the users myself.  I am just banging my head against the whole Jenkins architecture.  The code for the Log Parser Plugin seem like a good enough place to start but it is pretty involved and I am trying to learn Java while I figure out how it works.  And there does not seem to be any documentation on it's architecture (Log Parser Plugin architecture, not Jenkins.  I have read some of that.).

Kind of a rambling post I know.  I suppose I really just need some sort of a tutorial on how links are generated for pages using the jelly files.  I got the Jenkins O'Reilly book and it has some useful information but I haven't found much on plugin development in it. 

Thanks in advance.




Sandell, Robert

unread,
Oct 24, 2012, 10:34:25 AM10/24/12
to jenkin...@googlegroups.com

Most of the “things” you see on a build or job page are different types of hudson.model.Action objects that are added to the build or job.

If an Action object return something other than null from it’s getDisplayName, getIconFileName and getUrlName methods it will show up on the left side menu.

Clicking on the link will navigate to that action-instance’s “index” page. And the index page could be for example an index.jelly file or an implemented doIndex(StaplerRequest r, StaplerResponse s) method in the object if present.

 

For builds the action needs to be added somehow via build.addAction(), it normally is done from a BuildStep, a Recorder or a RunListener in the plugin.

 

The CloudBees blog has an article that explains Actions a bit more http://blog.cloudbees.com/2011/08/jenkins-internal-action-and-its.html

 

 

Robert Sandell

Software Tools Engineer - Tools and Integration

Sony Mobile Communications

Terry Hayes

unread,
Oct 24, 2012, 12:06:00 PM10/24/12
to jenkin...@googlegroups.com
A good link.  thanks for the quick response.  Still digesting what it says, but it looks like this is information on how to add items to the sidebar for a project (under say Jenkins -> project name) while I need to add an item to the link for a each build (Jenkins->project name->#42)

The sidebar menu for that has items like "Status", "Changes", "Console output", "Delete build" etc.

I would like to add another item there, something like "Build logs".

The subsection about the URL namespace and the host object does seem to be the right direction I need to go in, however, so I will look into how I get my plugin to get called from the right host object.

Thanks again.
Reply all
Reply to author
Forward
0 new messages