Log build file size using Jenkins and display results - jenkins

This is a broad question, so any answers are deeply appreciated. I need to continually log the size of several build files (in this case some CSS and JS files), preserve this log and ideally show it as a dashboard in Jenkins.
I know that I can setup a cron job and execute a bash script to grab the files and log their size, but I'm not sure where this file would live and how to display it. Ideally the result would be a dashboard plot or bar graph over time.
Thanks.
P.S. I'm open to other logging suggestions, but Jenkins seems like the appropriate system to do this in.

Update: this isn't perfect but it works. Google Spreadsheets has a simple API for posting data, so this can work as an endpoint for any script you want to write that logs your data.
It's not a Jenkins solution, but gets the job done.
In my search leading up to this, I did come across JMeter, and the Performance Plugin for Jenkins, which were contenders for a possible solution.

Related

Jenkins Dashboard view to show multiple Cucumber Reports

Background: we have like ~50 Jenkins jobs (and more to come) executing Cucumber scenarios and generating and posting reports using Cucumber Reports Plugin.
Problem: Cucumber reports can be inspected only one by one; I mean, we have to go through all the jobs and to check the relevant reports.
Question: Is there an already existing solution to create a Jenkins Dashboard View and to put there all the reports (column view, matrix view, whatever)? I tried Dashboard View plugin, but does not support Cucumber reports. Radiator View Plugin did not fix my problem either. I would like to have a single dashboard view and to see all the Cucumber reports for the added test execution jobs.
I had the same problem. I could not find anything. I solved it by writing a simple app that combed the cucumber-reports directories and read the cucumber-trends.json files.
I then output this to an html page that I landed in userContent.
Whole process took about a day, less time than I spent looking for a pre-made solution...

how to show quantitative results in Jenkins

Jenkins test results screen shows only pass/failed results.
I would like to show quantitive (number/percentage/time duration etc') results, parsed from logs.
e.g. memory usage, run time of specific methods etc..
What is the best way to do so?
Thanks
good question.
i imagine you're probably looking to extend your Jenkins instance with some plugins that describe more info about the tests you've run. this plugin seems relevant, but requires some experience with JMeter (java-based performance measurment tool) to generate the output that this plugin can then read and display output from a JMeter task that you can run every time your build runs:
https://wiki.jenkins-ci.org/display/JENKINS/Performance+Plugin
the 'readme' in the above plugin details page specifies how to set up a project to run JMeter( see the 'Configuring a project to run jmeter performance test:' near the bottom.
another way to do similar not so immediately tied to a specific jenkins build is to run resource monitors (like Cacti or collectd) on the machines running the tests and analyze those results post-build, but again, outside of the Jenkins context.
HTH.

Change SpecFlow+ runner report output link

We are using Jenkins in our build cycle to run our specflow tests. We are trying to find a better way to surface the test results. The generated html report file is great, but right now we have to manually log into the build server to check it out. I want to surface that file via a clickable link.
Here is what I am talking about specifically. Here is the test results via our Jenkins console
I want to change the highlighted text to an http url so that everyone can just click that and view the file.
I already have the http link working, so that's not the issue. I just need to figure out how to make specrun output this link here.
Any ideas on if this is possible? And if so how to do it?
Thanks for the help!
Sorry, this is currently not possible in SpecFlow+Runner, but I will put it on the backlog as a feature request.
Perhaps you can do something in Jenkins to parse the output and reformat the link.
Full disclosure: I am on of the developers of the SpecFlow+Runner.

How do I get a list of jobs with longest build time in Jenkins

I need to generate a weekly report on our Jenkins build cluster. One of the reports is to display a list of jobs that have the longest build time.
The solution I can come up with is to parse the "Build history" page on each slave (also master) and for each build of a job, parse the build page and look for "Took x min x sec on slave-xx".
This feels quite cumbersome, does anyone know a better solution using Jenkins API or Groovy script console?
Thanks
You can get the build data for your report through the Jenkins API. For a given job, you can
retrieve the list of builds with duration information using something like:
http://jenkins:8080/job/my-job/api/json?tree=builds[id,number,duration,timestamp,builtOn]
To see a list of all the API-available build data for a given job:
http://jenkins:8080/job/my-job/api/json?tree=builds[*]
Once you have a query that retrieves the job information that you need for
your report, it should be straightforward to loop over the jobs.
Most Jenkins pages have a link at the bottom to the REST API that describes a bit about accessing the API for that page, e.g. http://jenkins:8080/job/my-job/api.
How about using plugins?
Check this out:
https://wiki.jenkins-ci.org/display/JENKINS/build-metrics-plugin
There are few others too which you can try depending on how much customization/features you want to do/display:
https://wiki.jenkins-ci.org/display/JENKINS/Global+Build+Stats+Plugin - This is quite extensive
https://wiki.jenkins-ci.org/display/JENKINS/Project+Statistics+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/eXtreme+Feedback+Panel+Plugin

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