My own html report in build summary - jenkins

Previously, I used testlink. This plugin generated a nice table with the test results in the build summary view.
Now, I don't use testlink anymore, so this plugin cannot be used. But instead, I want to feed a html report (which I take care of generating) to the build summary view.
I tried HTML Publisher Plugin, but it makes a link instead of displaying in the build summary view.
Is there such a plugin that allows me to specify that a certain .html file from the workspace will be included?
Bonus question: or even a plugin that allows a .html fragment to avoid the use of i-frames?

Try using the Summary Display Plugin. It work pretty good.
The configuration is a bit tricky so I'm adding an example screenshot of my configuration.

Related

Is it possible to show all the submits from a Perforce depot without having to select a job?

We are currently attempting to setup an instance of Jenkins as our build system for our code base. We have multiple jobs setup (all using the same depot) to build different sections of the code.
We would now like to show the submits from all users pertaining to this depot on the main Jenkins screen rather than being able to view the change lists involved with a certain build (e.g. by selecting a certain job and then the link leading to the build information, etc...). I've looked into possible plugins and the closest one I was able to find was the "All Changes Plugin". This is exactly what we would like, but this is only visible when viewing the details of a build (e.g. which CLs were used to create the build), but would it be possible to show this type of information on the main Jenkins page instead?
Thank you in advance for your help.
You could write an extension for the Dashboard View plugin to provide a portlet containing an aggregated list of changes from perforce, though if you aren't experienced with writing plugins then you might be better off using a separate repository browser such as Fisheye or P4Web to display your changes.

Make an URL a result of Hudson build

I have a build job which uploads results to a certain URL.
How can I have a link to that URL shown on the build page?
I've tried to create an html page with redirect and add it to the artifacts but it seems a bit weird.
Per job run? Or global for the whole job?
If your link is always static (example: latest artifacts only), you can use a Sidebar link plugin. https://wiki.jenkins-ci.org/display/JENKINS/Sidebar-Link+Plugin that will place a static link per job (for all runs).
If your link changes per run, here is what I do in my environment. I update the run's description with an <a href> tag. The link won't show on the run page, however it works rather nicely in the build history.
Note above, the [Debug] and [Release] are unique links for each particular build.
For this, you would need Description Setter Plugin. https://wiki.jenkins-ci.org/display/JENKINS/Description+Setter+Plugin. And in the plugin (it is post-build action), just write pure HTML. You can use usual environment variables in there
Link here
Edit: note that nowadays it isn't that easy (if at all possible) to put html in the build history description. It does work on the individual build page.
If you want markup to be treated as such, you must enable it: Manage Jenkins > Global Security > Markup Formatter = Safe HTML
Then, for Jenkins scripted pipelines, you can simply set the currentBuild.description property with some HTML. Example:
currentBuild.description = "Click <a href='http://yourlink'>here</a>"
The rendered HTML will show in the build history and on the build page.
If you don't see "Safe HTML" in the Markup Formatter drop-down, you probably need to install the OWASP Markup Formatter plugin.
At the time of this post, the Blue Ocean GUI will not display HTML for build descriptions. See issue here: https://issues.jenkins.io/browse/JENKINS-45719
This Chrome extension can serve as a workaround:
https://chrome.google.com/webstore/detail/blue-ocean-description-ht/maahpenodjcdhodbonmdkfgnceddigae

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?
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.
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
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.
I just created a plugin that displays console output of latest build at the project page.
https://github.com/jenkinsci/display-console-output-plugin
To use this plugin, you have to type mvn hpi:hpi to create a display-console-output.hpi file. Then upload this plugin from http://localhost:8080/pluginManager/advanced.
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
May be you don't need it, you can click in the status button in the left of each build, each button show console output for each build.
Of course, this feature may not be operative in all Jenkins versions.
The solution for your problem is the https://wiki.jenkins-ci.org/display/JENKINS/Extra+Columns+Plugin plugin for Jenkins. After installing it you may modify your view to add a button for the console output as an additional column.
For a declarative pipeline, you can show a link to the console right where the progress bar shows up by adding this line at the very top of the file:
currentBuild.description = """Job console"""
This depends on a plugin and a setting, both of which were already on my system:
The OWASP Markup Formatter plugin provides the setting Security > Configure Global Security > Markup Formatter, which should be set to "Safe HTML".
The setting Jenkins -> Manage Jenkins -> Configure System -> Jenkins Location -> Jenkins URL needs to be the URL of your Jenkins installation.

Configure the ext-mail of hudson

I have a grails project and I use hudson to follow different analysis. I want to send the report analysis (cobertura, codenarc, findbug) to the developer. However, I don't know how to use hudson's ext-mail. Through googling I suspect the solution is to use jelly sscript but I can seem to get it to work.
If the default jelly templates don't have everything you need in them, you can customize them without much effort.
Grab a copy of the default template: Default Jelly Templates
Modify it as needed
Place a copy in JENKINS_HOME\email-templates (create the dir if needed)
Configure the build to utilize the new template. If your new script is ensienne.jelly, the email content would look like this ${JELLY_SCRIPT,template="ensienne"}.
Side Note: Hudson was renamed to Jenkins a while back.
Also, here is a good resource for the email-ext plugin: Email-ext wiki

Is there a better way of viewing team build logs?

Currently the msbuild logs for team build are appalling as they are just plain text and are very difficult to read. Also the ones created by my build are approx 30Mb and take quite a while to download (our TFS server is in our datacentre).
Does anyone know any way of being able to view these logs easier, prefereably integrated with either TFS itself or TFS WebAccess?
Take a look at the following blog post I did a while ago:
http://www.woodwardweb.com/teamprise/000415.html
This describes how to create a simple ASP.NET page that will stream the contents of your log file to you over HTTP. The advantage of doing it this way is that you don't have to wait for the entire page to load before the log starts to render for you in Visual Studio.
Also - you can add some simple formatting to the file while streaming. In the example on my blog I simply make the start of each target appear in bold to make them stand out a bit more, but you can see how you could go crazy with this approach if you wanted.
If increasing bandwidth isn't an option then I would suggest you to write your own html logger and attach it to the build process. Splitting the html build log into minor parts (definded by targets and/or projects) and having one index file pointing to all the minor parts with appropiate information whether a given part failed or succeeded. Then you only need to parse the index file and any requested part over the link.
A third possibility is to compress the log-file after the build completes.

Resources