Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

GitBlit plugin for Gerrit Code Review

12,921 views

Published on

See how GitBlit has been plugged into Gerrit Code Review as repository viewer.

Includes a step-by-step guide on how to clone, build and use GitBlit plugin on Gerrit.

Published in: Education
  • I had deployed a gitblit instance and I can able to clone my project and its visible in gitblit UI. Similarly, I have a gerrit UI which currently were not showing any code. Everything is blank. My goal is I have to integrate the gitblit code into gerrit as a code review tool. I tried thishttp://www.slideshare.net/lucamilanesio/gitblit-plugin-for-gerrit-code-review. I can able to run the maven successfully after clearing so many issues. But in gerrit UI, I can able to see the blank page with gerrit sections. Can you please help what I am doing wrong here. You have any documentation for gitblit+gerrit.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

GitBlit plugin for Gerrit Code Review

  1. 1. Plugin Luca Milanesio GerritForge LLP Luca@gerritforge.com http://www.gerritforge.com
  2. 2. Whos that guy ? Gerrit GitBlit plugin by Luca Milanesio is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. gerrit User Summit 2012
  3. 3. Why a different Git front-end ?Large enterprises = different people ! Gerrit "gurus" ? … likes rare GWT UI Git early adopters ? … used to GitWeb Like it new and small ? … gitiles is for you ? Like shiny and simple UX ? GitBlit  Gerrit GitBlit plugin by Luca Milanesio is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. gerrit User Summit 2012
  4. 4. Why GitBlit and not others ? just democratic election I guess  Hi all, as Gerrit 2.5 is coming to the+1, thats a great idea, Id like RC phase (and PlugIns willto use that. soon be a reality), what do youWould be great if this would think of integrating GitBlit asintegrate GitBlit in a way so plug-in ?that Gerrit permissionsettings are respected also byGitBlit. +1, it would be awesome to have a built-in viewer option that respected all the Gerrit perms@James: would you acceptcontribution to GitBlit to makethis plug-in possible ?Of course. Sounds great! Gerrit GitBlit plugin by Luca Milanesio is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. gerrit User Summit 2012
  5. 5. GitBlit UX 1. Twitter Bootstrap CSS + 2. Wicket Web- Framework + 3. Google Charts + 4. JQuery Front-end = COOL UX ! Gerrit GitBlit plugin by Luca Milanesio is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. gerrit User Summit 2012
  6. 6. GitBlit + Gerrit challenge GitBlit Gerrit UX Bootstrap / JQuery GWT CSS Front-end Wicket GWT Git Back-end JGit JGit DB none H2/MySQL/Postgres Injection none Guice License Apache 2.0 Apache 2.0 Gerrit GitBlit plugin by Luca Milanesio is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. gerrit User Summit 2012
  7. 7. Problems – Wicket and RomeWicket and Rome Class loader Session-based fully featured Web-App Classes are loaded using the current thread class loader: wicket/src/main/java/org/apache/wicket/application/DefaultClassResolver.java wicket/src/main/java/org/apache/wicket/protocol/http/ContextParamWebApplicationFactory.java wicket/src/main/java/org/apache/wicket/util/resource/locator/ResourceStreamLocator.java wicket/src/main/java/org/apache/wicket/protocol/http/portlet/WicketPortlet.javaGerrit plug-in loader Sessionless Servlet container Plug-in = unique shaded jar URLClassLoader (child of Gerrit ClassLoader) Gerrit GitBlit plugin by Luca Milanesio is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. gerrit User Summit 2012
  8. 8. Problems – GitBlit pluggabilityGitBlit configuration Configuration based (reference.properties) Classes instantiated directly wicket/src/com/gitblit/GitBlit.javaGerrit plug-in module Plug-in loaded and configured through Guice Module Class instantiated through child Guice Injectors Gerrit GitBlit plugin by Luca Milanesio is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. gerrit User Summit 2012
  9. 9. Solutions Wicket and Rome Option-1: patch-set github.com/lucamilanesio/wicket/commit/4a3f2c1dccf064008f223bb554c90e12c1c3b55d github.com/lucamilanesio/rome/commit/f13a20ae1e1f5df6a5bf4b83e8fb8fae6dda7a13 Options-2: drop wicket and rome wars into $GERRIT_SITE/libs GitBlit Patch provided and merged to GitBlit master github.com/gitblit/gitblit/commit/85f639aa3eee0b4e02eba20e6a5197b684941544 Gerrit Jetty session manager introduced in Gerrit 2.5 gerrit-review.googlesource.com/#/c/37790/ Gerrit GitBlit plugin by Luca Milanesio is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. gerrit User Summit 2012
  10. 10. GitBlit plugin: clone + build + deploy$ git clone https://gerrit-review.googlesource.com/plugins/gitblitCloning into gitblit...remote: Counting objects: 37, doneremote: Total 37 (delta 5), reused 37 (delta 5)Unpacking objects: 100% (37/37), done.$ cd gitblit && mvn package && cp target/gitblit*jar $GERRIT_SITE/plugins/gitblit.jar[INFO] --------------------------------------------------------------[INFO] Building Gerrit - GitBlit Plugin 1.0-SNAPSHOT[INFO] ---------------------------------------------------------------[... Some Maven rubbish ...][INFO] ---------------------------------------------------------------[INFO] BUILD SUCCESS[INFO] --------------------------------------------------------------- Gerrit GitBlit plugin by Luca Milanesio is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. gerrit User Summit 2012
  11. 11. GitBlit in action  Gerrit GitBlit plugin by Luca Milanesio is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. gerrit User Summit 2012
  12. 12. GitBlit as GitWeb replacementFrom Gerrit 2.6, GitBlit provides an automatic Gerrit init-step$ $ java –jar gerrit.war init -d $GERRIT_SITE[...normal Gerrit init process ...]*** GitBlit Integration***Do you want to use GitBlit as your GitWeb viewer ? [Y/n]? yLink name [GitBlit]:$ cat $GERRIT_SITE/etc/gerrit.config[...normal Gerrit config ...][gitweb] type = custom url = plugins/ project = gitblit/summary/${project} revision = gitblit/commit/${project}/${commit} branch = gitblit/log/${project}/${branch} filehistory = gitblit/history/${project}/${branch}/${file} linkname = GitBlit Gerrit GitBlit plugin by Luca Milanesio is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. gerrit User Summit 2012
  13. 13. GitBlit as repo browser in Gerrit Gerrit GitBlit plugin by Luca Milanesio is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. gerrit User Summit 2012
  14. 14. GitBlit plugin: next steps GitBlit Groovy scripts  Gerrit stream events available as "plug-in hooks"  GitBlit Groovy scripts executed within Gerrit GitBlit simple access control  Control Gerrit security through GitBlit  Provide Gerrit visibility of GitBlit groups via plug-inTo view this slides again:www.slideshare.net/lucamilanesio Gerrit GitBlit plugin by Luca Milanesio is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. gerrit User Summit 2012

×