Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins: Display last console output on project page

When viewing a project in Jenkins, I'd like to see the last console output displayed on the project page.

This satisfies two needs:

  • I most often just want to see what the output of the build was; clicking through to the last console output seems needlessly cumbersome
  • Non-technical management can't remember how to / aren't sufficiently motivated to click through to the last console output in cases where the output is relevant to them if only they were to easily see it

I've looked for plugins that support this but can't find any.

What options do I have?

like image 574
Jon Cram Avatar asked Feb 29 '12 09:02

Jon Cram


4 Answers

First an easy solution: job descriptions (push 'edit description' button on the main job page) admit HREF links. Make that link your latest build console permalink (http://[jenkins_server]/job/[job-name]/lastBuild/console).

If even one click is too much, here's a possible solution: you can use log contents as the description of your job. You can update your job via Jenkins CLI with:

java -jar jenkins-cli.jar -s http://[jenkins-server] update-job [job-name] < config.xml

So what you need to do is this: after your jobs run, trigger another job that will take the triggering job and console output file as parameters, substitute <description> in the job's config.xml with the contents of the console file (with proper escaping, etc.), and run the update command as above. Of course, this solution is labor-intensive and bug-prone.

like image 115
malenkiy_scot Avatar answered Nov 02 '22 04:11

malenkiy_scot


I had this same questions myself and I ended up finding this option useful...

http://[jenkins-server]/job/[job-name]/[build-number|lastBuild]/logText/progressiveText?start=0
like image 34
Phillip Fleischer Avatar answered Nov 02 '22 06:11

Phillip Fleischer


Edit: This no longer works in the current version of Jenkins

Similar to malenkiy_scot's answer, you can actually embed iframes in the description.

I use:

<iframe src='lastBuild/consoleText' style='width: 80%; height: 500px'></iframe>

as my project description, and it shows the latest console text in the project description page.

like image 4
Nathan T Avatar answered Nov 02 '22 05:11

Nathan T


You can simply just use one of these plugins:

http://wiki.hudson-ci.org/display/HUDSON/Hudson+Personal+View

https://wiki.jenkins-ci.org/display/JENKINS/Console+Column+Plugin

like image 1
Arek Avatar answered Nov 02 '22 06:11

Arek