Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

511 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The meta-shift plugin for Jenkins

About

A plugin for Jenkins to capture and visualize various software quality metrics for Yocto based projects using the reports generated by the meta-shift layer.

The list of software quality metric:

  • Unit test
  • Statement coverage
  • Branch coverage
  • Mutation test

Note (0.6.0): The static-analysis, cache, code-size, and tested-recipes metrics were removed because the current meta-shift layer no longer produces their reports. This plugin now targets the current meta-shift (scarthgap) layer. Build results and job threshold settings from older versions need to be re-run / re-entered.

Note (0.7.0): The per-metric detail pages were merged into the build and recipe pages (the distribution now renders inside each metric card), and the annotated source page was replaced by a per-file annotation summary (uncovered line ranges, partially covered branches, and mutation details). Source files are no longer stored with the build. Reports from builds published by older versions need to be re-run to be viewable.

Note (0.8.0): The annotated source page is back: the current meta-shift layer writes a metadata.json (the BitBake S variable) into each task report directory, so the plugin now stores the reported source files with the build at publish time (capped at 1MB per file) and paints coverage, branch and mutation annotations directly on the source. The per-metric file tables of the recipe page were merged into a single per-file table, unit tests link to their source lines, the build overview highlights the worst failing recipes, and the CSV/Excel export buttons were removed. Builds published by older versions fall back to the annotation summary on the file page.

Note (0.9.0): The build and recipe pages are now tabbed (Overview / Recipes / Tests / Mutations on the build page; Overview / Tests / Files / Mutations on the recipe page), with donut charts for unit test and mutation status and a version badge per recipe. The project page is a real trend page now (chart + recent-builds table) instead of redirecting to the latest build. The build log lists the pass/fail judgment for each metric, including which ones had no report at all. The annotated source page still depends on the BitBake S path being resolvable on the node that runs the metashift step at publish time — e.g. it is not resolvable when the build and report stages run on different nodes/workspaces and only the report directory is stashed between them. When it is not, the file page falls back to the annotation summary, same as 0.8.0; use the raw HTML report link instead.

You may find more information about the meta-shift layer on https://github.com/shift-left-test/meta-shift

Getting started

Configuration

The meta-shift plugin is configured at the job level by adding a meta-shift report post build action. The configuration parameters include:

  • Report Root Path: Specify the path to meta-shift report files in the Ant glob syntax, such as **/build/test-reports/*.xml.
  • Unstable: If this option is checked, then the plugin marks the build status as unstable if the value of the metric does not satisfy the threshold.
  • Threshold: The threshold represent the minimum value which the metric is required to be qualified

You may also configure the parameters on the Jenkins system configuration panel, which are globally available in the whole pipeline by default.

Raw report HTML

The plugin archives the raw HTML pages generated by the meta-shift layer (gcovr coverage, sentinel mutation testing, gtest unit test) with the build and serves them itself, styled, from the recipe page — no archiveArtifacts, HTML Publisher plugin, or Resource Root URL setup needed. Archiving is best-effort: a failure is logged but never fails the build, and only *.html files under the report root are kept.

The reports are served under a sandboxing Content-Security-Policy so their own inline scripts/styles render while the page itself cannot reach Jenkins cookies or APIs. To use a different policy, set one of these system properties (the first that is set wins):

System property Scope
com.lge.plugins.metashift.reportCsp This report only
hudson.model.DirectoryBrowserSupport.CSP Jenkins-wide, shared with workspace/artifact browsing

Setting an empty value disables the header entirely.

Development

Requirements

  • Maven (3 or above)
  • Java development kit (9 or above)

How to build the plugin

$ mvn package

How to test

$ mvn verify

How to run locally (invokes a local Jenkins instance with the plugin installed)

$ mvn hpi:run -Dhost=0.0.0.0 -Djetty.port=12345

License

This project source code is available under MIT license. See LICENSE.

Releases

Packages

Used by

Contributors

Languages