All Projects → onepremise → gReview

onepremise / gReview

Licence: Apache-2.0 license
A Bamboo plugin integrating Gerrit which allows Bamboo to verify changes and update the Gerrit review system.

Programming Languages

java
68154 projects - #9 most used programming language
FreeMarker
481 projects
CSS
56736 projects

gReview - The Bamboo Gerrit Integration Plugin

This plugin polls Gerrit for changes submitted to the Gerrit review system. When a new change is submitted, gReview will checkout the change and verify it builds. gReview will update the Gerrit change to reflect the correct score for a successful or unsuccessful build.

Features

  • Gerrit Code Review Integration.
  • GitWeb Integration.
  • Builds and Verifies Changes Submitted to Gerrit.
  • Changes are built independently in the order they are submitted.
  • Change dependencies are resolved naturally through Gerrit PatchSets.
  • Change comments automatically updated with build results.
  • Gerrit Change Display Tab available in Build Summary.
  • Git submodule support.
  • Remote trigger builds from Gerrit.
  • Branching support
  • All the Features Provided By Bamboo

Requirements

Install

Bamboo

The Bamboo install guide can be found here.

Gerrit

A quick install is available here.

A Tomcat install guide is also in the works.

gReview

This plugin can be installed via the Universal Plugin Manager in Bamboo.

Note: Resave your repository settings in your projects, which use Gerrit, to store your settings with the most recent format and save mechanisms.

Usage

Setup Gerrit

  • Login as admin.
  • Select 'Configure Plan' under 'Actions' in the dropdown menu on the right.
  • Select the 'Source Repositoryies' Tab.
  • Select 'Add Repository'.

Optional Gerrit Branch Configuration

By default, gReview is configured to draw down changes from Gerrit using the master branch. If you choose, you may overide this setting and configure to poll all branches or a specific custom branch. However, keep in mind, this setting may be redundant if you use Bamboo's branching features. If you choose to overide the default branch, you will find the settings available here:

  • Login as admin.
  • Select 'Configure Plan' under 'Actions' in the dropdown menu on the right.
  • Select the 'Source Repositoryies' Tab.
  • Select the repository you intend to configure.
  • If the repository is 'linked', follow the link to your repository.
  • Goto 'Advanced options'
  • Under 'Default Branch', select master, 'All branches', or specify your custom branch.
  • Save

Enable Gerrit Verification

  • Login as admin.
  • Select 'Plan Configuration' under 'Actions' in the dropdown menu on the right.
  • Select the 'Stages' Tab.
  • Select the job you're interested in. Usually there is only one, 'Default Job'.
  • Under the job configuration, select the "Miscellaneous" tab.
  • Check 'Run Gerrit Verification after main build.'

Viewing Gerrit Change Information

Gerrit change information is available under the Build Summary Gerrit Tab

Adding Gitweb

Creating A Branch (Gerrit UI)

  • Login to Gerrit.
  • Select Projects->List->'YourProject'
  • Enter your new branch below beside "Branch Name"
  • Provide the initial revision, leave as HEAD for branch off master
  • Hit 'Create Branch'

Checkout Branch Made from Gerrit UI

  • git fetch origin
  • git checkout new-branch

Creating A Branch (Git Console)

  • git checkout -b new-branch origin/master
  • git checkout master
  • git push origin HEAD:new-branch
  • git checkout new-branch
  • git push origin HEAD:refs/for/new-branch

Remote Trigger Builds

  • Go under 'Plan Configuration'=>'Triggers'.
  • Select trigger which applies, usually the first trigger.
  • Switch the setting from existing 'Polling the repository for changes' to 'Repository triggers the build when changes are committed'.
  • Make sure the checkbox is selected for the repository you're using in your plan.
  • If you enter an IP for security reasons, make sure it matches the hostname in your repo configuration. However, it should work fine if you leave empty.
  • Hit 'Save'.

Troubleshooting

Connection Issues

Make sure you have Gerrit setup correctly with SSH identity key generated and host used in the SSH connection string added to known host. Detailed instructions are available in the Gerrit documentation.

Note: Some builds will still hang in native msysgit mode on Windows due to the following issue with the bamboo-git-plugin: https://jira.atlassian.com/browse/BAM-11096.

You can work around this issue by manually adding your hostname, used in the repository configuration, to the msysgit/.ssh/known_hosts file. Example:

127.0.0.1 ssh-rsa XXXXB3NzaC1yc2EAAAADAQABBBBgQC699HzXHwr1H6OJeVlRo7h4r+3PY d0wNkqzl6EUAeU2iZjqFqQL2ZiNVqs2JrpTNadbgtXBNk9rhQIWajQZG9ZJG/OPxe+NOkbWQVev rcELsw5N2wxcJOWz+ey1tFv3VCtNCLUGgF7yIg0kZZVQ+HvAzLoMbiHs0haVmEjnLherSw==

NullPointerException Encountered after Upgrade

If this is an upgrade, and you encouter a NullException when attempting to build, you may need to resave your repository settings.Release 1.2.3 changed the way the ssh private key is stored for multiple repositories. Resaving should resolve this issue.

Unable to Delete Repository

This is an old issue and has been fixed in new releases of Bamboo. Here's the ticket.

Debugging

If problems persist, you can turn on debugging in the Administration console to help resolve and report issues. Steps to turn on debugging:

  • Goto Administration->System->Log Settings
  • Add com.houghtonassociates.bamboo.plugins=DEBUG

Check your Bamboo home directory for log output:

Ex: bamboo-home\logs\atlassian-bamboo.log

Bug Fixes and Enhancements

1.4.6.7 Updates

  • Fixed NullPointerException in ViewGerritChainResultsAction.

1.4.6.5 Updates

  • Support for Bamboo 5.10.0-5.10.3
  • Upgrade the jGit plugin to 4.0.3
  • Upgrade gerrit-events to 2.5.0
  • Migrate to new annotations for NotNull and Nullable

1.4.5.1 Updates

  • Bring OSGi and Pom configuration up-to-date
  • Upgrade atlassian plugin model to support 5.8.0-5.9.10
  • Upgrade dependencies to support 5.8.0-5.9.10
  • Upgrade the bamboo jGit plugin
  • Upgrade gerrit-events to 2.1.0
  • Remove BuildStrategy, TriggeredBuildStrategy, ImmutableChain.getTriggers deprecated references from GerritRepository and replace with newer call conventions

1.4.3.6 Updates

  • Added capability for merging gerrit specific branches

1.4.2.1 Updates

  • Support for Bamboo 5.6.0
  • Added capability for creating branches

1.4.1.20 Updates

  • Support for Bamboo 5.1.0 - 5.5.1
  • Resolved permissions on configuration directory for MetaConfig
  • Added Support for remote triggering builds from repository

1.4.0 Updates

  • Tested with Gerrit 2.9
  • Added capability for retrieving local and remote branches.
  • Added functionality to support getOpenBranches.
  • Resolved dependency loading issues with OSGI for 5.2-5.6
  • Provided mechanism to change default branch to pull changes from
  • How to restrict bamboo to poll the changes only on a particular branch #26
  • gReview problem - bamboo is checking out master branch #30

1.3.0 Updates

  • Removed Native Git dependency, replaced by latest jGit
  • Removed bamboo-git plugin dependency
  • Added submodule support
  • Resolved dependency loading issues with OSGI
  • Resolved path parsing issues with remote and local agent on Linux
  • Extended Support for 4.2.1 - 5.1.1
  • Issue #23 Changes discovering problem
  • Issue #27 Bamboo 4.3 support

1.2.9 Updates

  • Issue #21 Gerrit Chain Results screen shows changes from other repositories
  • Issue #20 Edit Gerrit Repository' screen force to re-enter passphrase for private key
  • Issue #19 NPE on Bamboo agent after job is dispatched by gReview

1.2.8 Updates

  • Issue #16 4.2.X Support.

1.2.3 Updates

  • Issue #13 gReview doesn't uniquely store connections settings per plan.

1.2.2 Updates

  • Issue #12: NullPointer exception encountered in GerritService

1.2.1 Updates

  • Issue #11: Error message reported by failed build can break verification update.

1.2.0 Updates

  • Issue #10: Exclude Display of Commit Action Tag in Build Changes
  • Issue #9: Exception on failed build
  • Issue #8: Setting non standard port does not work
  • Issue #7: Include Build Results URL for Verified Changes in Gerrit
  • Issue #6: GitWeb Integration

1.1.3 Updates

  • Issue #5: Gerrit Tab Displays on Unrelated Plans

1.1.2 Updates

  • Issue #4: Build Plan Fails When no Changes Open

1.1 Updates

  • Issue #1: Checkout Fails When Bamboo Configured with Native Git
  • Issue #2: Add Git Submodules Capability

Development Branches

  • 4.2.1-5.0.1: Use this branch for updates to the cooresponding releases
  • master: Master supports ongoing development for 5.1.1 +

How to build the Bamboo Gerrit Plugin

Impatient way:

  1. `mvn package' (Apache Maven 2.2.1 was used to develop this plugin)

More patient way:

  1. Download and install the latest JDK.
  2. Download and install the Atlassian Plugin SDK.
  3. Run `atlas-package -DskipTests' in the directory containing Bamboo Gerrit Plugin pom.xml.
  4. Grab plugin JAR file from `./target/greview-.jar'.

Full documentation on how to develop Atlassian Plugins is available at the Atlassian Developer Site.

How to deploy Git Plugin into existing Bamboo instance

Full documentation on installing Atlassian Plugins is available at:

Maintainer

Jason Huntley

profile for Jason Huntley on Stack Exchange, a network of free, community-driven Q&A sites
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].