Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo

1

Plugin


 Luca Milanesio
 GerritForge LLP

 Luca@gerritforge.com
 http://www.gerritforge.com

2

Who's 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

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

Why GitBlit and not others ?

 just democratic election I guess                                                                                                   Hi all,
                                                                                                            as Gerrit 2.5 is coming to the
+1, that's a great idea, I'd like                                                                             RC phase (and PlugIns will
to use that.                                                                                              soon be a reality), what do you
Would be great if this would                                                                                 think of integrating GitBlit as
integrate GitBlit in a way so                                                                                                     plug-in ?
that Gerrit permission
settings are respected also by
GitBlit.                                                                                                 +1, it would be awesome to have
                                                                                                                a built-in viewer option that
                                                                                                            respected all the Gerrit perms
@James: would you accept
contribution to GitBlit to make
this 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

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

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

Problems – Wicket and Rome
Wicket 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.java




Gerrit 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

Problems – GitBlit pluggability
GitBlit configuration
 Configuration based (reference.properties)
 Classes instantiated directly
  wicket/src/com/gitblit/GitBlit.java




Gerrit 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

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

GitBlit plugin: clone + build + deploy

$ git clone https://gerrit-review.googlesource.com/plugins/gitblit
Cloning into 'gitblit'...
remote: Counting objects: 37, done
remote: 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

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

GitBlit as GitWeb replacement
From 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]? y
Link 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

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

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-in



To 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

More Related Content

GitBlit plugin for Gerrit Code Review

  • 1. Plugin Luca Milanesio GerritForge LLP Luca@gerritforge.com http://www.gerritforge.com
  • 2. Who's 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. 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. Why GitBlit and not others ? just democratic election I guess  Hi all, as Gerrit 2.5 is coming to the +1, that's a great idea, I'd like RC phase (and PlugIns will to use that. soon be a reality), what do you Would be great if this would think of integrating GitBlit as integrate GitBlit in a way so plug-in ? that Gerrit permission settings are respected also by GitBlit. +1, it would be awesome to have a built-in viewer option that respected all the Gerrit perms @James: would you accept contribution to GitBlit to make this 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. 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. 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. Problems – Wicket and Rome Wicket 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.java Gerrit 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. Problems – GitBlit pluggability GitBlit configuration  Configuration based (reference.properties)  Classes instantiated directly wicket/src/com/gitblit/GitBlit.java Gerrit 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. 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. GitBlit plugin: clone + build + deploy $ git clone https://gerrit-review.googlesource.com/plugins/gitblit Cloning into 'gitblit'... remote: Counting objects: 37, done remote: 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. 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. GitBlit as GitWeb replacement From 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]? y Link 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. 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. 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-in To 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