Skip to content

💡 Plugin aligning Jenkins and Bitbucket Server Code Insights API

License

Notifications You must be signed in to change notification settings

T45K/Bitbucket-Server-Code-Insights-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bitbucket Server Code Insights plugin

Build Status GitHub release CodeFactor codecov CodeQL License

Introduction

This plugin enables Jenkins to call Bitbucket Server Code Insights API.

What's Code Insights API?

https://docs.atlassian.com/bitbucket-server/rest/7.21.0/bitbucket-code-insights-rest.html

Getting started

Use the latest release

Just download the latest plugin from here.

Build on yourself

Building this plugin requires Java 11+.

  1. Clone this repository.
  2. Move into the directory.
  3. ./mvnw clean package
  4. Upload target/codeInsights.hpi on Jenkins.

Features

  1. Code analysis tool results will be shown on your PR diff view when you set code analysis tool settings (see Supporting code analysis tools).
  2. Coverage results will be shown on your PR diff view when you set JaCoCo settings. Furthermore, you can see the summary as a report.

Settings

Global settings

Set up in your-jenkins/configure.

Name Description required
bitbucketUrl URL of your Bitbucket. Yes
project Project name. Yes
reportKey Report Key of API (see document). Yes
username Your username of Bitbucket. Yes
password Your password of Bitbucket. Yes
SonarQubeUrl URL of your SonarQube Server. No
SonarQubeToken Token of your SonarQube account. No
SonarQubeUsername Username of your SonarQube account. No
SonarQubePassword Password of your SonarQube account. No

Local settings

Set up in your Job settings page or give in Jenkinsfile as parameter.

Name Description required default
repositoryName Your repository name. Yes -
srcPath Source path of your repository. No src/main/java
commitId Commit Sha of target branch. You can use env.GIT_COMMIT as commitId in Jenkins Multibranch pipeline job. Yes -
baseBranch Base branch of your repository (e.g., origin/main). No origin/master
checkstyleFilePath Relative path of Checkstyle result file from repository root (e.g., target/checkstyle-result.xml). No -
spotBugsFilePath Relative path of SpotBugs result file from repository root (e.g., target/spotbugsXml.xml). No -
pmdFilePath Relative path of PMD result file from repository root (e.g., target/pmd.xml) No -
SonarQubeProjectKey Project key of SonarQube project. If you use SonarQube plugin in Jenkins, specify the same value as XXX of mvn sonar:sonar -Dsonar.projectKey=XXX No -
qodanaFilePath Relative path of Qodana result file from repository root (e.g., report/qodana.sarif.json) No -
jacocoFilePath Relative Path of JaCoCo result file from repository root (e.g., target/site/jacoco/jacoco.xml) No -

Supporting code analysis tools

Currently, this plugin supports the following tools.

  • Checkstyle
  • SpotBugs
  • PMD
  • SonarQube
  • JetBrains Qodana

The following tools are planned to be supported in the future.

  • CodeQL
  • Fortify

Supporting coverage collecting tools

Currently, this plugin supports the following tools.

  • JaCoCo

LICENSE

Licensed under MIT, see LICENSE

Question, request, or report

Please tell me via Issue!