A jenkins plugin for CodeScene by Empear.
CodeScene detects potential maintenance problems and early warnings in your codebase. The earlier you can react to those findings, the better. That’s why CodeScene offers integration points that let you incorporate the analysis results into your build pipeline.
This plugin lets you use CodeScene’s Delta Analysis to catch potential problems before they are delivered to your main branch.
In addition to the risk classification, CodeScene also runs its set of early warning analyses:
The early warnings and risk classification let you prioritize your code reviews and focus your time where (and when) it’s likely to be needed the most. Code reviewer fatigue is a real thing, so let’s use our review efforts wisely.
The recommended way is to install the plugin via Jenkins Update Center (Jenkins -> Manage Jenkins -> Manage Plugins). You can find the latest version in Jenkins plugin repository.
Manual build and installation
You can build the latest version of plugin by running
mvn clean package and installing
to your Jenkins manually.
Configure Jenkins for CodeScene
Enable the CodeScene integration by adding a new build step in your Jenkins configuration. Select the option Run CodeScene Delta Analysis.
Enter the required information in the CodeScene Jenkins configuration:
Delta Analysis Settings
CodeScene gives you a number of options that controls the scope of the delta analysis:
- Individual Commits: Check this option to run a delta analysis on each individual commit. When in doubt, make this your default setting.
- By Branch: With this option, CodeScene runs a delta analysis on the difference between the branch you build and the one you provide as reference. Use this option if you want to analyse a whole pull request.
You can also change the defaults for risk threshold and temporal coupling threshold
- Risk Threshold: commits with risk equal or higher than this value will make a build unstable
- Temporal Coupling Threshold: minimum temporal coupling for "Absence of Expected Change Pattern" warning
By checking the Use Biomarkers option, CodeScene lets you auto-detect files that seem to degrade in quality through issues introduced in the current changeset. Biomarkers can be used since the CodeScene 2.4.0 version.
CodeScene API Configuration
The CodeScene API configuration section has to match the information specified inside CodeScene itself and retrievable from the analysis configuration (Project configuration -> Delta Analysis):
- Reverse the previously added configuration option so that a user explicitly has to allow an analysis failure to pass the build.
- Introduce a configuration option to mark builds as UNSTABLE rather than FAILED if a remote CodeScene analysis couldn't be performed.
- Add Biomarkers support to auto-detect files that seem to degrade in quality through issues introduced in a changeset - requires CodeScene version 2.4.0 or higher.
- Use credentials plugin for storing CodeScene API credentials instead of hardcoded username and password. Existing jobs will continue to work, but you won't be able to update job configuration (e.g. change username or password) until you switch to the credentials plugin. Check Injecting Secrets into Jenkins Build Jobs for more details.
- Only required parameters are now set in constructor. Optional parameters are set with setters. Check https://github.com/jenkinsci/pipeline-plugin/blob/c84a9af/DEVGUIDE.md#constructor-vs-setters. Original constructor has been removed!
- Specify mnemonic extension name "codescene" via
CodeSceneBuilder. Check https://github.com/jenkinsci/pipeline-plugin/blob/c84a9af/DEVGUIDE.md#defining-symbols and https://wiki.jenkins-ci.org/display/JENKINS/Structs+plugin for more details.
- Add new configuration field for temporal coupling threshold. The new field is set to 80 percent by default. Requires CodeScene 2.0+, otherwise the new settings doesn't have any effect.
- Add checksums to built artifacts in GitHub releases
- Delta analysis by branch, based on base revision
- Delta analysis by individual commits (new commits not seen in previous jobs)
- "Mark build as unstable" based on risk threshold
Licensed under the MIT License.