BitBucket Pull Requests

From Lingoport Wiki
Jump to: navigation, search

BitBucket

BitBucket is a Web-based Git repository hosting service. It integrates with all of the distributed revision control and source code management (SCM) functionality of Git as well as adding its own features.

BitBucket Pull Requests

Files can be committed in any of various Git branches. When changes are committed to branches other than the main, or master, branch, these alternate branches will need to be periodically merged into master. Pull requests provide a web-based format for reviewing what changes will be made by each merge. They allow for interested parties to see exactly what changes to source will be made, comment on these changes, discuss other potential modifications, and/or push followup commits if necessary.

SonarQube BitBucket Pull Request Plugin

The SonarQube BitBucket Plugin is designed to provide SonarQube analysis information directly to the pull request interface. It can be used to provide a preview-mode analysis of the changes associated with the pull request. The plugin will overlay any issues detected in the new code as comments to the associated lines. When integrated with Lingoport analyses, the top Globalyzer and LRM detected issues in the new code may be displayed.

This plugin may be found on github here.

Note After downloading the latest version of the plugin, place the sonar-bitbucket-plugin.jar file in your Dashboard-Server-<version>/extensions/plugins directory.

Dashboard and Pull Requests

The Lingoport Dashboard is based on SonarQube and leverages the features associated with it. Starting with the Lingoport Dashboard 5.6.1, the BitBucket plugin is available. It can be used to show Dashboard issues within GitHub as comments on pull requests. These changes can then be reviewed prior to approving the pull requests.

In a typical use pattern, changes may be made on a tertiary branch. A pull request is then opened between this tertiary branch and the main (master) branch. Next, a Globalyzer and/or LRM scan is initiated against the tertiary branch. The results of these scans are compared with known results in master. If any issues are detected in the updated code, comments describing these issues are added directly to the relevant lines in the pull request.

To provide this functionality, SonarScanner - associated with the Lingoport Dashboard Client - is used to push the pull request issues to BitBucket. This is the same general mechanism that is normally used to push Lingoport-detected issues in the master branch directly to the Lingoport Dashboard. However, please note that the details of these two workflows differ. It is very important that you do not confuse them.

When configuring a primary analysis job on master, you will need to configure sonar.analysis.mode to issues. When configuring a bitbucket pull-request job on a tertiary branch, you will instead need to configure sonar.analysis.mode to preview. This configuration may be found within the sonar-project.properties file. In a typical Linux-based installation, this file will be generated under /var/lib/jenkins/Lingoport_Data, within the Lingoport data directory structure Dashboard/Projects/<Your Organization Name>.<The Project Name>. Please ensure that you edit the file, setting sonar.analysis.mode to the correct value.