[RFC] GitBlit http plug-in for Gerrit

900 views
Skip to first unread message

Luca Milanesio

unread,
Aug 7, 2012, 3:42:17 AM8/7/12
to Repo and Gerrit Discussion
Hi all,
as Gerrit 2.5 is coming to the RC phase (and PlugIns will soon be a reality), what do you think of integrating GitBlit as plug-in ?

We have bandwidth to start that piece of work now if there is interest :-)

P.S. GitBlit is an Apache 2.0 project, so it is even compatible with Gerrit OpenSource license.

Luca.
---
Luca Milanesio
Lu...@Milanesio.org
Mobile: +44-(0)7928-617383
Skype: lucamilanesio



Matthias Sohn

unread,
Aug 7, 2012, 3:53:34 AM8/7/12
to Luca Milanesio, Repo and Gerrit Discussion
2012/8/7 Luca Milanesio <luca.mi...@gmail.com>
+1, that's a great idea, I'd like to use that. 
Would be great if this would integrate GitBlit in a way so that Gerrit permission
settings are respected also by GitBlit.

--
Matthias

Luca Milanesio

unread,
Aug 7, 2012, 3:58:07 AM8/7/12
to Matthias Sohn, Repo and Gerrit Discussion
Yep, that was my intention.

In terms of "external integration" it is possible even now BUT:
- currently would be yet another JVM (or another WAR in the same Web Container)
- GitBlit would need extra config and SSO

... whilst integrated as plug-in the above two problems could be addressed and integrated into Gerrit.
(some work needed, that why we volunteered :-))

Luca.

Matthias Sohn

unread,
Aug 7, 2012, 6:44:13 AM8/7/12
to Luca Milanesio, Repo and Gerrit Discussion
2012/8/7 Luca Milanesio <luca.mi...@gmail.com>

Yep, that was my intention.

In terms of "external integration" it is possible even now BUT:
- currently would be yet another JVM (or another WAR in the same Web Container)
- GitBlit would need extra config and SSO

... whilst integrated as plug-in the above two problems could be addressed and integrated into Gerrit.
(some work needed, that why we volunteered :-))

nice
 
--
Matthias

Nasser Grainawi

unread,
Aug 7, 2012, 10:24:45 AM8/7/12
to Matthias Sohn, Luca Milanesio, Repo and Gerrit Discussion
+1, it would be awesome to have a built-in viewer option that respected all the Gerrit perms

 
--
Matthias

--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum

Luca Milanesio

unread,
Aug 7, 2012, 12:58:52 PM8/7/12
to Nasser Grainawi, Matthias Sohn, Martin Fick, Repo and Gerrit Discussion
Can Martin (or somebody else) create a plug-in project for this in the gerrit-review.googlesource.com ?

Proposed project name:
plugins/gitblit

Proposed project description:
GitBlit code-viewer plug-in with SSO and Security Access Control

---
Luca Milanesio
Lu...@Milanesio.org
Mobile: +44-(0)7928-617383
Skype: lucamilanesio



Shawn Pearce

unread,
Aug 7, 2012, 1:14:46 PM8/7/12
to Luca Milanesio, Nasser Grainawi, Matthias Sohn, Martin Fick, Repo and Gerrit Discussion
Created.

Luca Milanesio

unread,
Aug 7, 2012, 1:23:11 PM8/7/12
to Shawn Pearce, Nasser Grainawi, Matthias Sohn, Martin Fick, Repo and Gerrit Discussion
Thanks Shawn,
we will start working on that right now :-)

Luca.

Luca Milanesio

unread,
Aug 22, 2012, 9:25:25 AM8/22/12
to Repo and Gerrit Discussion, Shawn Pearce, Nasser Grainawi, Matthias Sohn, Martin Fick, Luca Milanesio
Hi all,
we have a first prototype working :-) and honestly looks gorgeous !

There is one problem though: we need support for Jetty sessions. 
Is there any reason why Gerrit Jetty container has no session support enabled ?

We needed to add the following line on JettyServer.makeContext() 
+ app.setSessionHandler(new SessionHandler());

Is there any problem if we would push that change to master ?
(this would allow the plug-in to work inside Gerrit without any extra moving piece and with SSO and Security integrated)

Thank you in advance for the feedback.

Luca.

Luca Milanesio

unread,
Sep 7, 2012, 3:06:22 AM9/7/12
to Repo and Gerrit Discussion, Shawn Pearce, Nasser Grainawi, Matthias Sohn, Martin Fick, Edwin Kempin
We have finalised the GitBlit plug-in ... but we need a 2 lines change in Gerrit to make it working.
(see my previous e-mail below).

The change required is here:

This change has no effects in Gerrit (as no JSESSIONID is used) but enables the use of GitBlit plug-in (and potentially many others as well). Ideally it would be nice to get this reviewed and approved for Gerrit 2.5 as well :-)

Thank you in advance for your help :-)

Luca.

Luca Milanesio

unread,
Sep 25, 2012, 12:56:50 PM9/25/12
to Luke Last, repo-d...@googlegroups.com, Shawn Pearce, Nasser Grainawi, Matthias Sohn, Martin Fick, Edwin Kempin
Hi Luke,
it is not published yet :-( ... let me work this out over the week-end to get it pushed for review.

Luca.

On 25 Sep 2012, at 17:47, Luke Last <lu...@ghue.net> wrote:

I'm willing to test this plugin, if someone can send it to me or show me how to find it?
-Thanks

Luke Last

unread,
Oct 15, 2012, 12:43:15 PM10/15/12
to repo-d...@googlegroups.com, Luke Last, Shawn Pearce, Nasser Grainawi, Matthias Sohn, Martin Fick, Edwin Kempin
Any update on this? It would be really great to have GitBlit in Gerrit.
Thank you for working in it.

Luca Milanesio

unread,
Oct 15, 2012, 1:32:49 PM10/15/12
to Luke Last, repo-d...@googlegroups.com, Shawn Pearce, Nasser Grainawi, Matthias Sohn, Martin Fick, Edwin Kempin
Hi Luke,

I really need to publish this now: I was waiting for getting an agreement with James Moger (GitBlit author) to get the GitBlit changes into his mainstream ... but I will publish them on GitHub in the meantime (and the Gerrit-GitBlit plugin to Gerrit).

Major obstacles for me were the Rome and GitBlit class loader: they were getting through the current thread and then did not work with Gerrit plug-in loader.
I have customised both of them (simple changes) to make them working inside Gerrit.

Pushing all the files now for review: still not tidy up and I would like to ... but can be useful for the people to start cloning it and using it.

Luca.

Luca Milanesio

unread,
Oct 15, 2012, 7:18:36 PM10/15/12
to Luke Last, repo-discuss@googlegroups.com Discussion, Shawn Pearce, Nasser Grainawi, Matthias Sohn, Martin Fick, Edwin Kempin, Luca Milanesio
Hi Luke,

you can start download and building a first prototype here:

It is not complete and not ready yet for review for a couple of reasons:
a) I need to make GitBlit more "plain-vanilla" compared to the current amended branch (https://github.com/lucamilanesio/gitblit)
b) I would like to avoid copying the GitBlit resources into the plug-in (or at least doing it during the build)

... and moreover I need GitBlit maintainer to accept and merge our extensions.

Early feedback on our work is appreciated anyway :-)
Plug-in is "plug & play": just build and drop into $GERRIT_SITE/plugins ... it just works !
(you can access it from the plug-in URL ${gerrit.canonicalWebUrl}/plugins/gitblit-plugin-1.0-SNAPSHOT/)

Enjoy :-)

Luca.

On 15 Oct 2012, at 17:43, Luke Last <lu...@ghue.net> wrote:

Shawn Pearce

unread,
Oct 15, 2012, 9:43:37 PM10/15/12
to Luca Milanesio, Luke Last, repo-discuss, Nasser Grainawi, Matthias Sohn, Martin Fick, Edwin Kempin
On Mon, Oct 15, 2012 at 10:32 AM, Luca Milanesio
<luca.mi...@gmail.com> wrote:
> Major obstacles for me were the Rome and GitBlit class loader: they were
> getting through the current thread and then did not work with Gerrit plug-in
> loader.

Maybe Gerrit should try harder to set the current thread's context
ClassLoader before calling a filter or servlet from the plugin?

Luca Milanesio

unread,
Oct 16, 2012, 2:57:27 AM10/16/12
to Shawn Pearce, Luke Last, repo-discuss, Nasser Grainawi, Matthias Sohn, Martin Fick, Edwin Kempin, Luca Milanesio
That would help *but* I don't see how this can be easily achieved ;-(

The beauty of current plug-ins is that they can be injected in a generic Guice module and provide an additional implementation of an existing Gerrit interface: this makes Gerrit "calling" transparently the plug-ins though Guice injection.

However Gerrit itself doesn't know it's calling a plug-in ... and so I don't see how he can then set/unset the ClassLoader before calling the plug-ins methods ;-( ... the only possibility would be another "Guice magic" and provide a transparent proxy that set the ClassLoader and restore it after method is finished: it would have performance impact anyway.

Honestly I don't see this ClassLoader limitation a bit problem anyway, I could even try to use the "plain" Rome and GitBlit by simply automatically extracting during init (then I would need https://gerrit-review.googlesource.com/#/c/38041/) the "ClassLoader-sensitive" jars out of the plug-in into the $GERRIT_SITE/lib.

Luca.

Luke Last

unread,
Oct 16, 2012, 5:30:03 PM10/16/12
to repo-d...@googlegroups.com, Luke Last, Shawn Pearce, Nasser Grainawi, Matthias Sohn, Martin Fick, Edwin Kempin, Luca Milanesio
Thank you very much, it installs easily.

My first suggestion would be to have links to gitblit in Gerrit's UI, when that becomes possible for plugins to do.

Luca Milanesio

unread,
Oct 17, 2012, 3:14:49 AM10/17/12
to Luke Last, repo-d...@googlegroups.com, Shawn Pearce, Nasser Grainawi, Matthias Sohn, Martin Fick, Edwin Kempin
Yep, the same would apply to the Network Branch HTML5 canvas (I am about to push in those days)
Again it will be configurable as alternative renderer to GitWeb *BUT* it would be nice to plug into the repository detail tabs.

Luca.

Luca Milanesio

unread,
Oct 20, 2012, 3:46:57 PM10/20/12
to repo-d...@googlegroups.com, Luke Last, Shawn Pearce, Nasser Grainawi, Matthias Sohn, Martin Fick, Edwin Kempin
Hi all,
I have finalised the GitBlit plug-in for Gerrit and now is available for review at:

I worked with James Moger (author and maintainer of GitBlit) in order to allow more "pluggability" of GitBlit and make the plug-in compile and work with a "plain vanilla" GitBlit JAR :-)

GitBlit master (https://github.com/gitblit/gitblit/commits/master) now contains my patch and so gitblit-plugin for Gerrit has to be build against GitBlit 1.2-SNAPSHOT (as indicated in the pom.xml)

P.S. *IF* you apply https://gerrit-review.googlesource.com/#/c/38041/ to Gerrit, then GitBlit plug-in will even automatically configure itself during the Gerrit init-step, otherwise you need to configure the GitWeb section manually.

Enjoy and feedbacks are very welcome.

Luca.

On 16 Oct 2012, at 22:30, Luke Last <lu...@ghue.net> wrote:

Reply all
Reply to author
Forward
0 new messages