When the Dogus is started, it is checked whether the JAR file of the “Community Branch Plugin” exists in /opt/sonar/extensions/downloads or /opt/sonar/extensions/plugins and then also copied to /opt/sonar/lib/common.
This is necessary so that the plugin can be executed correctly and the dogu starts.
move the downloaded JAR file to /var/lib/ces/sonar/volumes/extensions/plugins/
restart SonarQube
Installation via the update center
The “Community Branch Plugin” can also be installed via the Update Center.
create an update center .properties file and enter the required version of the “Community Branch Plugin” there.
Example:
plugins=communityBranchPluginpublicVersions=9.8,9.9,9.9.1,9.9.2,9.9.3,9.9.4,9.9.5,9.9.6,9.9.7,9.9.8,10.0,10.1,10.2,10.2.1,10.3,10.4,10.4.1,10.5,10.5.1,10.6,10.7,10.8,2025.1ltaVersion=2025.1ltsVersion=2025.1sqcb=24.12,25.1,25.2sqs=10.8,10.8.1,2025.1date=2025-02-27T12\:54\:36+0000communityBranchPlugin.publicVersions = 1.14.0,1.23.0communityBranchPlugin.versions = 1.14.0,1.23.0communityBranchPlugin.archivedVersions =communityBranchPlugin.category = External AnalyzerscommunityBranchPlugin.description = Enables branch and pull request analysis in SonarQube Community Edition, without having to upgrade to Developer EditioncommunityBranchPlugin.developers = Michael ClarkecommunityBranchPlugin.homepageUrl = https://github.com/mc1arke/sonarqube-community-branch-plugincommunityBranchPlugin.issueTrackerUrl = https://github.com/mc1arke/sonarqube-community-branch-plugin/issuescommunityBranchPlugin.license = GNU LGPL 3 LICENSEcommunityBranchPlugin.name = Community Branch PlugincommunityBranchPlugin.scm = https://github.com/mc1arke/sonarqube-community-branch-plugincommunityBranchPlugin.1.14.0.changelogUrl = https://github.com/mc1arke/sonarqube-community-branch-plugin/releasescommunityBranchPlugin.1.14.0.date = 2022-12-31communityBranchPlugin.1.14.0.downloadUrl = https://github.com/mc1arke/sonarqube-community-branch-plugin/releases/download/1.14.0/sonarqube-community-branch-plugin-1.14.0.jarcommunityBranchPlugin.1.14.0.requiredSonarVersions = 9.8,9.9,9.9.1,9.9.4,9.9.5,9.9.6,9.9.7,9.9.8communityBranchPlugin.1.14.0.sqVersions = 9.8,9.9,9.9.1,9.9.4,9.9.5,9.9.6,9.9.7,9.9.8communityBranchPlugin.1.14.0.description = This version supports Sonarqube 9.8 and above. Sonarqube 9.7 and below are not supported in this release.communityBranchPlugin.1.14.0.mavenGroupId = com.github.mc1arke.sonarqube.plugincommunityBranchPlugin.1.14.0.mavenArtifactId = sonar-community-branch-plugincommunityBranchPlugin.1.23.0.changelogUrl = https://github.com/mc1arke/sonarqube-community-branch-plugin/releasescommunityBranchPlugin.1.23.0.date = 2024-12-31communityBranchPlugin.1.23.0.downloadUrl = https://github.com/mc1arke/sonarqube-community-branch-plugin/releases/download/1.23.0/sonarqube-community-branch-plugin-1.23.0.jarcommunityBranchPlugin.1.23.0.requiredSonarVersions = 10.8,2025.1communityBranchPlugin.1.23.0.sqVersions = 10.8,2025.1communityBranchPlugin.1.23.0.sqcb=24.12,25.1,25.2communityBranchPlugin.1.23.0.sqs=10.8,10.8.1,2025.1communityBranchPlugin.1.23.0.description = This version supports Sonarqube 2025.1 and above. Sonarqube 9.9 and below are not supported in this release.communityBranchPlugin.1.23.0.mavenGroupId = com.github.mc1arke.sonarqube.plugincommunityBranchPlugin.1.23.0.mavenArtifactId = sonar-community-branch-plugin
Several versions of the plugin can be stored for the respective SonarQube version.
For SonarQube <= 9.9, *.sqVersions must match publicVersions and the installed SonarQube version
For SonarQube > 2025.1, *.sqcb must match sqbc and *.sqs must match sqs and the installed SonarQube version
host the update center .properties file on a web server available without authentication
customize the Dogu-Config for SonarQube:
Update-Center-URL: etcdctl set /config/sonar/sonar.updatecenter.url https://domain.de/update-center.properties
Default plugins that are installed at startup: etcdctl set sonar.plugins.default communityBranchPlugin.
restart SonarQube
When installing the “Community Branch Plugin” via the UpdateCenter for the first time, Sonar must be restarted so that the plugin is copied to the correct location as described above.
If the web server does not have a valid HTTPS certificate, the Update Center cannot be used.
In order for the certificate to be trusted, it must be stored in the Dogu:
the certificates must be in PEM format.
the certificates must be available in etcd below /config/_global/certificate/additional/
> The key name (also called Alias) is used for addressing and internal dogu storage and should not contain any spaces.
The FQDN of the service would be useful here (e.g. service.example.com) so that a certificate can be removed more easily at a later date
A key can have more than one certificate for a service. Certificates in PEM format have textual markers that can be used to separate the certificates again.
the key name under which the certificate was stored must be stored in etcd under /config/_global/certificate/additional/toc.
> Certificates of different services must be separated by a single space
restart Dogu
Example:
# Create key nameetcdctl set /config/_global/certificate/additional/toc 35.198.174.144# Create certificate from filecat ./test.crt | etcdctl set /config/_global/certificate/additional/35.198.174.144
Testing the SonarQube Community Plugin
Prerequisite: SonarQube is set up as described here
install the “Community Branch Plugin” as described above
in the SCM Manager: install the editor and review plugins
This makes it possible to edit source files without git clone ... ; git commit ...
edit spring-petclinic/ master branch
create a sonar-project.properties in the SCM Manager (if not already available)
see below for an example file
this ensures that SonarQube finds the built .class files
enrich the Jenkinsfile in the SCM Manager so that stage("build") and stage("integration test") are also available
see below for an example file
This ensures that SonarQube also scans PR branches and informs Jenkins about the status
in SonarQube: redeclare the main branch (only if necessary)