integrate gerrit with github

2,637 views
Skip to first unread message

Ameya Varade

unread,
Sep 26, 2013, 10:44:46 AM9/26/13
to repo-d...@googlegroups.com
Hi, 
I am trying to integrate gerrit with github.  I am using this [https://gerrit.googlesource.com/plugins/github/+/62512fd78b4def9d6f3809fc700e0bca199ec24f] revision of a gerrit plugin for github [https://gerrit.googlesource.com/plugins/github/]
This is the article I am referring to. http://www.packtpub.com/article/using-gerrit-with-github
During gerrit init the wizard prompts for gerrit integration setup which goes as expected. But it throws a configuration error if I hit the public gerrit page from the browser.
I am not using apache. It's just gerrit served from jetty. Does anybody know what's wrong here?


Configuration Error

Check the HTTP server's authentication settings.

The HTTP server did not provide the username in the GITHUB_USER header when it forwarded the request to Gerrit Code Review.

If the HTTP server is Apache HTTPd, check the proxy configuration includes an authorization directive with the proper location, ensuring it ends with '/':

<VirtualHost hostname:8080>
    ServerName hostname.com

    ProxyRequests Off
    ProxyVia Off
    ProxyPreserveHost On

    <Proxy *>
          Order deny,allow
          Allow from all
    </Proxy>

<Location /login/> AuthType Basic AuthName "Gerrit Code Review" Require valid-user ... </Location>
AllowEncodedSlashes On ProxyPass / http://.../ nodecode </VirtualHost>

Luca Milanesio

unread,
Sep 26, 2013, 10:49:36 AM9/26/13
to Ameya Varade, repo-d...@googlegroups.com
Hi Ameya,
you get the error when Gerrit is using HTTP header authentication (in this case GITHUB_USER) whilst no header is provided.

The GitHub integration has two components:
- Plugin (which you have installed)
- Servlet filter (which is possibly missing)

The servlet filter is the one in this case responsible of enriching the HTTP requests with GITHUB_USER header.
(not apache in this case)

Can you post the listing of your $GERRIT_SITE/lib and $GERRIT_SITE/plugins directories ?

HTH

Luca.

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ameya Varade

unread,
Sep 26, 2013, 11:22:24 AM9/26/13
to repo-d...@googlegroups.com, Ameya Varade
Hi,
Thanks for the reply.

listing of 
$GERRIT_SITE/lib --> github-oauth-2.8-SNAPSHOT.jar

$GERRIT_SITE/plugins --> commit-message-length-validator.jar  github.jar  replication.jar  reviewnotes.jar

github.jar(github-plugin-2.8-SNAPSHOT.jar) is the plugin jar.

and here is the gerrit.config

[gerrit]
        basePath = git
        canonicalWebUrl = http://canonicalWebUrl:8080
[database]
        type = h2
        database = db/ReviewDB
[auth]
        type = HTTP
        httpHeader = GITHUB_USER
[sendemail]
        smtpServer = localhost
[container]
        user = root
        javaHome = /usr/java/jdk1.7.0_21/jre
[sshd]
        listenAddress = *:29418
[httpd]
        listenUrl = http://*:8080/
        filterClass = com.googlesource.gerrit.plugins.github.oauth.OAuthFilter
[cache]
        directory = cache
[github]
        url = https://github.com
        clientId = 12345
        clientSecret = 1234567890


Best regards,
Ameya

Luca Milanesio

unread,
Sep 26, 2013, 11:32:11 AM9/26/13
to Ameya Varade, repo-d...@googlegroups.com
Hi Ameya,

the filter is out there (github-oauth-2.8-SNAPSHOT.jar) but the Gerrit [auth] section is missing one important value:

[auth]
loginUrl = /login

Without it Gerrit assumes that you are *already logged in* which is not necessarily true: that why you are getting an error page.
If you add that value, Gerrit will show an anonymous browsing experience with the possibility to login in on the top-right corner.

Once you click the login, the /login will be intercepted by the GitHub OAuth Servlet Filter and the OAuth handshake and authentication will happen: after that you will be logged in Gerrit.

One additional side note: for getting your e-mail and full name automatically provisioned in Gerrit, add the following extra settings to your [auth] stanza:

        httpDisplayNameHeader = GITHUB_NAME
        httpEmailHeader = GITHUB_EMAIL

HTH.

Luca.

Stan Rosenberg

unread,
Feb 3, 2014, 11:35:58 AM2/3/14
to repo-d...@googlegroups.com, Ameya Varade
Hi,

I am somewhat late to the game since last update was over a year ago...  I am trying to get github plugin for gerrit (https://gerrit.googlesource.com/plugins/github) to compile.
There are several issues.  Even after changing parent version from 2.8-SNAPSHOT to 2.9-SNAPSHOT, and changing org.kohsuke.github-api version from
1.44-SNAPSHOT to 1.44, there are several compilation problems in github-plugin.  Any help is welcome.

Thanks!

stan

Luca Milanesio

unread,
Feb 3, 2014, 12:33:26 PM2/3/14
to Stan Rosenberg, repo-d...@googlegroups.com, Ameya Varade
Have you tried using the stable-2.8 branch ? (With its latest changes under review)

Luca
---------
Sent from my iPhone
Luca Milanesio
Skype: lucamilanesio

Stan Rosenberg

unread,
Feb 3, 2014, 12:43:54 PM2/3/14
to Luca Milanesio, repo-d...@googlegroups.com, Ameya Varade
I have tried stable-2.8 branch to no avail.  There were similar compilation issues.

Luca Milanesio

unread,
Feb 3, 2014, 12:49:43 PM2/3/14
to stan.ro...@gmail.com, repo-d...@googlegroups.com, Ameya Varade
What are the compilation issues you have ?
Can you display the SHA1 you're using and the errors you've got ?

Luca
---------
Sent from my iPhone
Luca Milanesio
Skype: lucamilanesio

Stan Rosenberg

unread,
Feb 3, 2014, 1:00:46 PM2/3/14
to Luca Milanesio, repo-d...@googlegroups.com, Ameya Varade
In github,

git show
commit 4ba7702e3c79e3a37eab4ff13a56654e4fd1fd1c

In gerrit,

git show
commit a8a303c809404f191c5ad775525ed0b0741c98ee

Following are compilation errors in GitHub plugin when compiled against 2.9-SNAPSHOT and org.kohsuke.github-api:1.44 (1.44-SNAPSHOT is not resolvable via public maven repos).


[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project github-plugin: Compilation failure: Compilation failure:
[ERROR] /Users/Stan/Downloads/github/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/PullRequestListController.java:[35,25] error: cannot find symbol
[ERROR] package org.kohsuke.github
[ERROR] /Users/Stan/Downloads/github/github-plugin/src/main/java/com/googlesrouce/gerrit/plugins/github/git/PullRequestImportJob.java:[36,25] error: cannot find symbol
[ERROR] package org.kohsuke.github
[ERROR] /Users/Stan/Downloads/github/github-plugin/src/main/java/com/googlesrouce/gerrit/plugins/github/git/PullRequestImportJob.java:[37,51] error: package org.kohsuke.github.GHPullRequestCommitDetail does not exist
[ERROR] /Users/Stan/Downloads/github/github-plugin/src/main/java/com/googlesrouce/gerrit/plugins/github/git/PullRequestImportJob.java:[232,19] error: cannot find symbol
[ERROR] class PullRequestImportJob
[ERROR] /Users/Stan/Downloads/github/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/PullRequestListController.java:[152,59] error: method listPullRequests in class GHRepository cannot be applied to given types;
[ERROR] actual and formal argument lists differ in length
[ERROR] /Users/Stan/Downloads/github/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/PullRequestListController.java:[182,9] error: cannot find symbol
[ERROR] class PullRequestListController
[ERROR] /Users/Stan/Downloads/github/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/PullRequestListController.java:[183,8] error: cannot find symbol
[ERROR] variable ghPullRequest of type GHPullRequest
[ERROR] /Users/Stan/Downloads/github/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/InitGitHub.java:[21,7] error: InitGitHub is not abstract and does not override abstract method postRun() in InitStep
[ERROR] /Users/Stan/Downloads/github/github-plugin/src/main/java/com/googlesrouce/gerrit/plugins/github/git/PullRequestCreateChange.java:[197,31] error: method create in interface Factory cannot be applied to given types;
[ERROR] actual and formal argument lists differ in length
[ERROR] /Users/Stan/Downloads/github/github-plugin/src/main/java/com/googlesrouce/gerrit/plugins/github/git/PullRequestCreateChange.java:[217,8] error: no suitable constructor found for Change(Key,com.google.gerrit.reviewdb.client.Change.Id,com.google.gerrit.reviewdb.client.Account.Id,NameKey)
[ERROR] constructor Change.Change(Key,com.google.gerrit.reviewdb.client.Change.Id,com.google.gerrit.reviewdb.client.Account.Id,NameKey,Timestamp) is not applicable
[ERROR] (actual and formal argument lists differ in length)
[ERROR] constructor Change.Change() is not applicable
[ERROR] (actual and formal argument lists differ in length)
[ERROR] /Users/Stan/Downloads/github/github-plugin/src/main/java/com/googlesrouce/gerrit/plugins/github/git/PullRequestCreateChange.java:[269,8] error: no suitable constructor found for ChangeMessage(Key,com.google.gerrit.reviewdb.client.Account.Id,<null>)
[ERROR] constructor ChangeMessage.ChangeMessage(Key,com.google.gerrit.reviewdb.client.Account.Id,Timestamp,com.google.gerrit.reviewdb.client.PatchSet.Id) is not applicable
[ERROR] (actual and formal argument lists differ in length)
[ERROR] constructor ChangeMessage.ChangeMessage() is not applicable
[ERROR] (actual and formal argument lists differ in length)
[ERROR] /Users/Stan/Downloads/github/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/RepositoriesListController.java:[85,33] error: method listRepositories in class GHPerson cannot be applied to given types;
[ERROR] actual and formal argument lists differ in length
[ERROR] /Users/Stan/Downloads/github/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/RepositoriesListController.java:[89,27] error: method listRepositories in class GHPerson cannot be applied to given types;
[ERROR] actual and formal argument lists differ in length
[ERROR] /Users/Stan/Downloads/github/github-plugin/src/main/java/com/googlesrouce/gerrit/plugins/github/git/PullRequestImportJob.java:[202,9] error: cannot find symbol
[ERROR] class PullRequestImportJob
[ERROR] /Users/Stan/Downloads/github/github-plugin/src/main/java/com/googlesrouce/gerrit/plugins/github/git/PullRequestImportJob.java:[202,54] error: cannot find symbol

Luca Milanesio

unread,
Feb 3, 2014, 3:26:37 PM2/3/14
to Stan Rosenberg, repo-d...@googlegroups.com, Ameya Varade
Dear Stan,
the github plugin 4ba7702 corresponds to an older point of stable-2.8 branch, and you should then compile against a Gerrit 2.8 (and not a 2.9-SNAPSHOT).

You can do:

1) git fetch https://gerrit.googlesource.com/plugins/github refs/changes/83/54083/3 && git checkout FETCH_HEAD

2) mvn clean package

3) Copy on top of a Gerrit 2.8 (not 2.9-SNAPSHOT)

HTH

Luca.

Luca Milanesio

unread,
Feb 3, 2014, 3:35:34 PM2/3/14
to Stan Rosenberg, repo-d...@googlegroups.com, Ameya Varade
One last point: I have used new features of the Kohsuke 1.44-SNAPSHOT release that have been then included in the 1.45.

Luca.

Stan Rosenberg

unread,
Feb 3, 2014, 3:41:47 PM2/3/14
to Luca Milanesio, repo-d...@googlegroups.com, Ameya Varade
Luca,

Thanks for your help!  I am down to only one compilation error which I can track down on my own.  But if you happen to know of a quick fix, please do share,

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project github-plugin: Compilation failure
[ERROR] /Users/Stan/Downloads/github/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/PullRequestListController.java:[152,59] error: method listPullRequests in class GHRepository cannot be applied to given types;

Thanks!

stan

Luca Milanesio

unread,
Feb 3, 2014, 4:41:49 PM2/3/14
to Stan Rosenberg, repo-d...@googlegroups.com, Ameya Varade
Ah ah ... I remember that one :-) I have introduced it in my pull request but Kohsuke did not include it !

You can build from my pull request in the meantime ... and I'll manage to adapt the stable-2.8 to a released version from Kohsuke.

Luca.

Luca Milanesio

unread,
Feb 3, 2014, 5:58:24 PM2/3/14
to Stan Rosenberg, repo-d...@googlegroups.com, Ameya Varade
Done, https://gerrit-review.googlesource.com/54274

By fetching the above change, it builds on top of Kohsuke GitHub API Ver. 1.45, without you to make any change.

HTH.

Luca.

Stan Rosenberg

unread,
Feb 4, 2014, 11:21:42 AM2/4/14
to Luca Milanesio, repo-d...@googlegroups.com, Ameya Varade
Beautiful, thanks!  I am now ready to try the plugin with gerrit.

Arsenij Solovjev

unread,
Mar 18, 2014, 7:33:13 PM3/18/14
to repo-d...@googlegroups.com, Ameya Varade
Hi Luca,

Using the same guide as Ameya, I've stumbled upon the same problem (namely the "Check the HTTP server's authentication settings." page). I've tried your suggestion and it didn't work. However I suspect it might have a
different cause than with Ameya since I keep getting this stack trace in the logs.

[2014-03-18 23:47:27,187] WARN  com.google.gerrit.server.plugins.PluginLoader : Cannot load plugin github
java.lang.NoClassDefFoundError: com/google/inject/Provider
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:412)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1471)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:412)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ...
    Caused by: java.lang.ClassNotFoundException: com.google.inject.Provider
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)


Versions used:
github-plugin 2.9-SNAPSHOT
gerrit-plugin-api 2.9-SNAPSHOT
github-oauth 2.9-SNAPSHOT

JRE:
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

OS:
Distributor ID:    Ubuntu
Description:    Ubuntu 10.04.4 LTS
Release:    10.04
Codename:    lucid

I've tried again, adding guice-3.0 and javax.inject to gerrit2/lib, however I got errors such as these:
1) Could not find a suitable constructor in com.googlesource.gerrit.plugins.github.oauth.GitHubLogin. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
2) Could not find a suitable constructor in com.googlesource.gerrit.plugins.github.oauth.GitHubLogin. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.

Would you know how to fix this?

Thanks in advance,
Arsenij

Luca Milanesio

unread,
Mar 19, 2014, 4:47:39 AM3/19/14
to Arsenij Solovjev, repo-d...@googlegroups.com, Ameya Varade
Hi Arsenij,
in your case the problem is completely different: your Gerrit instance cannot load the plugin at all :-(

The latest Change for review on the plugin works with the Gerrit 2.9-SNAPSHOT master version:

It seems that your Gerrit PluginLoad is not even able to access the Google Guice Injector ... you should have some serious Gerrit BUCK build problems.
Please make sure first that Gerrit *standalone* works fine and then try GitHub plugin and other plugins as well.

P.S. In my talk on Saturday 22nd - 13:30 @GooglePlex I will explain and show how to build and use the plugin: https://sites.google.com/site/gerritsummit2014/schedule

HTH

Luca.


For more options, visit https://groups.google.com/d/optout.

Arsenij Solovjev

unread,
Mar 19, 2014, 11:53:50 AM3/19/14
to repo-d...@googlegroups.com, Arsenij Solovjev
Hi Luca,

Thanks for the quick reply!

However, I was not able to make any progress. I used the 2.8 version (with all the correct dependencies, I double-double checked) using this guide here https://gerrit.googlesource.com/plugins/github/+/master/README.md, and built everything
from scratch.

Only one thing was peculiar: when I ran 'buck build gerrit' there were some ANTLR warnings and errors. The build
appeared to halt, so I Ctrl-C it and ran 'buck build gerrit' again. From that point on there was nothing out of the
ordinary (apart from the build taking 50 minutes).

The Gerrit that was thusly built works fine. I did not try out other plugins explicitly, though, but I recall replication-plugin
being alive and kicking.

But all the problems from my previous post are still there.

Cheers,
Arsenij

Luca Milanesio

unread,
Mar 19, 2014, 11:56:31 AM3/19/14
to Arsenij Solovjev, repo-d...@googlegroups.com
Hi Arsenij,
the GitHub plugin works with the 2.9-SNAPSHOT (not the 2.8 version).

There are specific Gerrit changes I pushed that make the plugin working ... otherwise it wouldn't work at all :-(

Luca.

For more options, visit https://groups.google.com/d/optout.

Luca Milanesio

unread,
Mar 19, 2014, 12:12:01 PM3/19/14
to Arsenij E Solovjev, Repo and Gerrit Discussion
If you want to try it up you can use it on-line at:

Alternatively my session on Friday @GooglePlex (slides published the same morning) will include a step-by-step GitHub plugin build exercise.

Luca.

Andre Saddler

unread,
Jun 5, 2014, 12:26:36 PM6/5/14
to repo-d...@googlegroups.com, stan.ro...@gmail.com, ameya....@clogeny.com
it does not work anymore

L Waver

unread,
Jul 16, 2014, 3:19:46 PM7/16/14
to repo-d...@googlegroups.com
Tried following Luca's guide as well in hopes to builds some required GitHub libs/plugins to get Gerrit to authenticate since Google is now out of commission.  Here are the errors I am receiving after 'mvn install'

 Path to dependency:
        1) com.googlesource.gerrit.plugins.github:github-oauth:jar:2.10-SNAPSHOT
        2) org.kohsuke:github-api:jar:1.57-SNAPSHOT

----------
2 required artifacts are missing.

for artifact:
  com.googlesource.gerrit.plugins.github:github-oauth:jar:2.10-SNAPSHOT

from the specified remote repositories:

Hope this helps, for as of right now, GitHub auth and Google auth are out of commission.  Any other service I can authenticate off of, besides Yahoo?

Thanks
X

Luca Milanesio

unread,
Jul 17, 2014, 3:02:15 AM7/17/14
to L Waver, repo-d...@googlegroups.com
There is a bug on the released version of the Kohsuke's GitHub API and I needed to fix it on the master branch (github-api:1.57-SNAPSHOT).

In order to build the "whole thing" you need then to download and build locally the Kohsuke's GitHub API master:
$ cd github-api
$ mvn install -DskipTests

Then build the GitHub plugin and it will succeed this time :-)

As soon as Kohsuke will cut a new release of github-api 1.57, will update the POM to point to the version released and published to Maven.

HTH

Luca.

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

--- 
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ha...@litmotors.com

unread,
Jul 21, 2014, 1:46:18 PM7/21/14
to repo-d...@googlegroups.com, xlight...@gmail.com
Hi Luca,

I'm trying to get the github integration working with Gerrit. Here is my setup:

Ubuntu 14 Server

Gerrit 2.9-rc2

github-api 1.50 @ c6fdae3b3c0e10968f53e5bd4783e9d586958748
github-oauth 2.9-SNAPSHOT @ 67ede1856992ef5477278afbd8cdd27f70bae865
github-plugin 2.9-SNAPSHOT @ 67ede1856992ef5477278afbd8cdd27f70bae865

The plugins build fine (with -DskipTests on github-api), and I install them into my gerrit. The authentication part works well. But whenever click on the GitHub tab links I get a 'Not found' returned. All of the other plugins I can access the static files, but I cannot for github-plugin:

mygerritsite.com/plugins/github-plugin-2.9-SNAPSHOT/static/repositories.html returns 'Not found'

However, the static files *are* in the built github-plugin jar file in the plugins folder and obviously the tabs show up in the interface so it's being recognized. Any ideas?

From the error log:


[2014-07-21 17:41:05,197] INFO  com.google.gerrit.pgm.Daemon : Gerrit Code Review 2.9-rc2 ready
[2014-07-21 17:41:26,456] ERROR velocity : ResourceManager : unable to find resource '' in any resource loader.
[2014-07-21 17:41:26,457] ERROR com.googlesource.gerrit.plugins.github.velocity.VelocityViewServlet : Cannot load velocity template
org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource ''
        at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:483)
        at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:354)
        at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1400)
        at com.googlesource.gerrit.plugins.github.velocity.VelocityViewServlet.service(VelocityViewServlet.java:89)
        at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:278)
        at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:268)
        at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:180)

Thanks!

Luca Milanesio

unread,
Jul 21, 2014, 7:28:44 PM7/21/14
to ha...@litmotors.com, repo-d...@googlegroups.com, xlight...@gmail.com
Seems like the velocity views names cannot be resolved.
There was a similar bug on master that I fixed some weeks ago: possibly needs to be cherry-picked to stable-2.9.

Luca.

Hayk Martirosyan

unread,
Jul 23, 2014, 3:04:47 PM7/23/14
to Luca Milanesio, repo-d...@googlegroups.com, xlight...@gmail.com
Where is the stable-2.9 branch? All I see are master and stable-2.8. My remote is
https://gerrit.googlesource.com/plugins/github

and

$ git branch -r
  origin/HEAD -> origin/master
  origin/master
  origin/stable-2.8

I just grepped for velocity in the git log, and saw two commits. Is it one of these?

--------------------

commit e60c6f9bf80c5e51dec43e75745e8b4b13706798
Author: Luca Milanesio <luca.mi...@gmail.com>
Date:   Thu Oct 10 17:19:22 2013 +0100

    Set velocity view content type to HTML.
   
    Previously the content type was not set and it
    was left to the Browser to properly understand the
    result output. That sometimes generated a plaintext
    HTML in some browsers.
   
    Change-Id: I5c9fd2cf5444dcd343d0d378df6df9353c06cf2c

----------------------

commit a5e06fd30a58db1ff81caa946887391f6b4b9e75
Author: Jonathan Nieder <j...@google.com>
Date:   Mon Jun 16 16:44:00 2014 -0700

    Update Velocity and enable strict reference mode
   
    This makes the velocity syntax more consistent with Gerrit itself, in
    particular making it easier to find misspelled variables or other
    mistakes in velocity templates.
   
    Change-Id: I752ec1d70f659eac4955de5311343a1161bde507

Luca Milanesio

unread,
Jul 23, 2014, 7:10:31 PM7/23/14
to Hayk Martirosyan, repo-d...@googlegroups.com, xlight...@gmail.com
mmm ... you're actually right :-) hasn't been created yet.
I've just created stable-2.9 out of the last commit before the full bump to 2.10.

CI Job created as well on:

I see some more commits needed to be cherry-picked, adapted and reviewed though:
3e068f4 [BugFix] /login not enriched when GerritOAuth expires
b8f5fd6 Fixed mispelled package name 'googlesrouce'
c783deb Fix datatables script link.
a06ab5e Fix email, add response to account handler.
2d6f69a Replace getServletPath() with getPathInfo()
0c49eec Bump GitHub-API to 1.53 (released)
9f4a6ca Fix list of emails broken by GitHub-API 1.53

Luca.

Daniel Shirley

unread,
Jul 29, 2014, 2:20:11 PM7/29/14
to repo-d...@googlegroups.com, ha...@litmotors.com, xlight...@gmail.com
I am seeing the same issue with the stable-2.9 branch .... i have opened a bug ticket here -- > https://code.google.com/p/gerrit/issues/detail?id=2803

Erik Castricum

unread,
Sep 2, 2014, 7:03:03 PM9/2/14
to repo-d...@googlegroups.com
Hi,
I am trying to migrate from openID to github oauth but I am stuck on below. Do I have to start a fresh start or is " migrating" users possible?

working on 2.10-rc0-293-g2ef2c76-dirty

[2014-09-03 00:55:45,493] ERROR com.google.gerrit.httpd.auth.container.HttpLoginServlet : Unable to authenticate user "erikcas"
com.google.gerrit.server.account.AccountUserNameException: Cannot assign user name
        at com.google.gerrit.server.account.AccountManager.handleSettingUserNameFailure(AccountManager.java:303)
        at com.google.gerrit.server.account.AccountManager.create(AccountManager.java:255)
        at com.google.gerrit.server.account.AccountManager.authenticate(AccountManager.java:113)
        at com.google.gerrit.httpd.auth.container.HttpLoginServlet.doGet(HttpLoginServlet.java:118)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
        at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:281)
        at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:271)
        at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:180)
        at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:93)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:85)
        at com.google.gwtexpui.server.CacheControlFilter.doFilter(CacheControlFilter.java:70)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
        at com.google.gerrit.httpd.auth.github.OAuthWebFilter.doFilter(OAuthWebFilter.java:87)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
        at com.google.gerrit.httpd.RunAsFilter.doFilter(RunAsFilter.java:113)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
        at com.google.gerrit.httpd.AllRequestFilter$FilterProxy$1.doFilter(AllRequestFilter.java:64)
        at com.google.gerrit.httpd.AllRequestFilter$FilterProxy.doFilter(AllRequestFilter.java:57)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
        at com.google.gerrit.httpd.RequestContextFilter.doFilter(RequestContextFilter.java:75)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
        at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:120)
        at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:133)
        at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:130)
        at com.google.inject.servlet.GuiceFilter$Context.call(GuiceFilter.java:203)
        at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:130)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1636)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:564)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:219)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1111)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:498)


 

snyh xia

unread,
Feb 2, 2015, 9:30:28 PM2/2/15
to repo-d...@googlegroups.com
I have successfully migrated from OpenID(yahoo) to github OAuth.

this simply script can do this. 
------------------------------------
#!/bin/bash

mi() {
    name="'gerrit:$2'"
    ssh -p 29418 10.0.0.8 gerrit gsql -c '"insert into account_external_ids (account_id, external_id) values ('$1', '$name');"'
}


mi 1000000 snyh
mi 1000001 githubuser
-----------------------------------------------------
first parameter is gerrit id which can be find in https://cr.deepin.io/#/settings/. and the second parameter is the github *ID*.

this script must be run before the first github oauth login. 
github-plugin will create new gerrit user automatically, so you must run this script before the user login by github oauth.

Luca Milanesio

unread,
Feb 3, 2015, 2:52:49 AM2/3/15
to snyh xia, repo-d...@googlegroups.com
Hi Snyh,
thank you for sharing this :-)

Should we possibly create a "migration path" inside the GitHub OAuth plugin by using this logic inside the code?
Or possibly during the init phase?

Luca.

Chris Harris

unread,
Feb 3, 2015, 7:59:00 AM2/3/15
to Luca Milanesio, snyh xia, Repo and Gerrit Discussion
This is what I have been working on todo for our migration. I have modified the OAuth plugin to is use the registered GitHub email address ( hence my questions yesterday :-) ) to try to identify the OpenId account associated with the user, I then insert the appropriate entry into the account_external_id table and then let the authentication continue. Of course there are a few corner cases such as users with the same email address register with multiple gerrit account, but for us it catches most users and it better than having todo it all manually.

Regards, 

Chris

Luca Milanesio

unread,
Feb 3, 2015, 7:59:47 AM2/3/15
to Chris Harris, snyh xia, Repo and Gerrit Discussion
Oh oh ... that is really cool indeed :-)
Are you ready to share your work?

Luca.

Chris Harris

unread,
Feb 3, 2015, 8:03:22 AM2/3/15
to Luca Milanesio, snyh xia, Repo and Gerrit Discussion
I will be happy to share, will probably not be in a state to merge ( its a little quick and dirty ), but always happy to share :-) I will push something to GitHub by the end of the day. 

Chris

Luca Milanesio

unread,
Feb 3, 2015, 8:14:24 AM2/3/15
to Chris Harris, snyh xia, Repo and Gerrit Discussion
Can it possibly be a change on the Gerrit-GitHub plugin?

Luca.

Chris Harris

unread,
Feb 3, 2015, 8:18:13 AM2/3/15
to Luca Milanesio, snyh xia, Repo and Gerrit Discussion
Not sure, it is currently in the OAuthWebFilter, the row needs to be inserted before the authenticate call hits the AccountManager.

Chris

Luca Milanesio

unread,
Feb 3, 2015, 8:27:40 AM2/3/15
to Chris Harris, snyh xia, Repo and Gerrit Discussion
You could then provide an alternative filter to be configured on:

[httpd]
filterClass = com.googlesource.gerrit.plugins.github.oauth.Openid2OAuthFilter

How does it sound?

Luca.

Chris Harris

unread,
Feb 3, 2015, 8:36:27 AM2/3/15
to Luca Milanesio, snyh xia, Repo and Gerrit Discussion
That sounds good. How would I ensure that filter is run after authentication with GitHub and before the authenticate call to the AccountManager? Also how would I get access to the GHMyself object?

Thanks, 

Chris

Luca Milanesio

unread,
Feb 3, 2015, 8:46:38 AM2/3/15
to Chris Harris, snyh xia, Repo and Gerrit Discussion
You just inject the GitHubLogin object as:
ScopedProvider<GitHubLogin> loginProvider;

And then you obtain the GHMyself as:
loginProvider.get(httpRequest).getMyself()

The filterClass is invoked *before* the entire Gerrit Guice-based filters ... and thus before the call to AccountManager.

Luca.

Chris Harris

unread,
Feb 3, 2015, 12:18:51 PM2/3/15
to Luca Milanesio, snyh xia, Repo and Gerrit Discussion
Hi Luca, 

So I started looking at moving me changes into a separate filter. However, I think I am a little confused! The current filter is com.googlesource.gerrit.plugins.github.oauth.OAuthFilter. Are you say create a copy of this and add my changes to it as an alternative? Also this class is in github-oauth rather than github-plugin ( you where say make my change on github-plugin)? 


Thanks

Chris

Luca Milanesio

unread,
Feb 3, 2015, 12:26:03 PM2/3/15
to Chris Harris, snyh xia, Repo and Gerrit Discussion
Hi Chris,
either  separate filter or a subclass would work.
It should be in the github-oauth part, which contains the servlet filters.

Luca.

Chris Harris

unread,
Feb 3, 2015, 1:20:40 PM2/3/15
to Luca Milanesio, snyh xia, Repo and Gerrit Discussion
Thank, I have things working in a separate filter now. One last question ( I hope :-) ). If I want to do a sendRedirect(...) to error page which I have added to github-plugin/src/main/resources/static, what is the correct URL? Or more generally how to I redirect to an error page?

Chris

Luca Milanesio

unread,
Feb 3, 2015, 1:32:22 PM2/3/15
to Chris Harris, snyh xia, Repo and Gerrit Discussion
/plugins/github-plugin/static/

Chris Harris

unread,
Feb 3, 2015, 1:44:18 PM2/3/15
to Luca Milanesio, snyh xia, Repo and Gerrit Discussion
I get a 404. I tried some existing html file as well for example:

http:/myhost/plugins/github-plugin/static/account.html


Luca Milanesio

unread,
Feb 3, 2015, 1:54:50 PM2/3/15
to Chris Harris, snyh xia, Repo and Gerrit Discussion
Try this :-)

It does work, make sure that the plugin name is 'github-plugin' and the file is contained in the plugin jar.

Luca.

Chris Harris

unread,
Feb 3, 2015, 2:11:42 PM2/3/15
to Luca Milanesio, snyh xia, Repo and Gerrit Discussion
Thanks, jar name have version :-( Also does access to these page redirect an authenticated session? In my case I am trying report an error that prevents the user logging in!

Chris Harris

unread,
Feb 3, 2015, 2:12:11 PM2/3/15
to Luca Milanesio, snyh xia, Repo and Gerrit Discussion
s/redirect/require/

Chris Harris

unread,
Feb 3, 2015, 3:03:36 PM2/3/15
to Luca Milanesio, snyh xia, Repo and Gerrit Discussion
OK, I have pushed what I have so far:


I am still have problems with doing a redirect at line 114. I get the following errors:

[2015-02-03 14:52:21,180] WARN  org.eclipse.jetty.server.Response : Committed before 403 null
[2015-02-03 14:52:21,181] WARN  org.eclipse.jetty.servlet.ServletHandler : /login
java.lang.IllegalStateException: Committed
at org.eclipse.jetty.server.Response.resetBuffer(Response.java:1246)
at org.eclipse.jetty.server.Response.sendError(Response.java:554)
at org.eclipse.jetty.server.Response.sendError(Response.java:542)
at com.google.gerrit.httpd.auth.container.HttpLoginServlet.doGet(HttpLoginServlet.java:124)

I guess it doesn't like a redirect during the login process?

Regards, 

Chris

Luca Milanesio

unread,
Feb 3, 2015, 4:44:25 PM2/3/15
to Chris Harris, snyh xia, Repo and Gerrit Discussion
GitHub? It would be much more useful to have a patch-set pushed to https://gerrit.googlesource.com/plugins/github.

Can you please do:
git push https://gerrit.googlesource.com/plugins/github HEAD:refs/for/master ?

Thanks, much appreciated :-)

Luca.

Chris Harris

unread,
Feb 3, 2015, 4:51:36 PM2/3/15
to Luca Milanesio, snyh xia, Repo and Gerrit Discussion
Happy to do that, done.

Chris

Luca Milanesio

unread,
Feb 3, 2015, 4:54:05 PM2/3/15
to Chris Harris, snyh xia, Repo and Gerrit Discussion
Thanks :-)

Luca.

Chris Harris

unread,
Feb 3, 2015, 4:56:30 PM2/3/15
to Luca Milanesio, snyh xia, Repo and Gerrit Discussion
There are merge conflicts as it based off 2.9, as that's what we are targeting, but a least you can review the code ...

I guess I should have done:

git push https://gerrit.googlesource.com/plugins/github HEAD:refs/for/stable-2.9 ?

Chris

Edwin Kempin

unread,
Feb 5, 2015, 7:42:07 AM2/5/15
to Chris Harris, Luca Milanesio, snyh xia, Repo and Gerrit Discussion
2015-02-03 21:03 GMT+01:00 Chris Harris <chris....@kitware.com>:
OK, I have pushed what I have so far:


I am still have problems with doing a redirect at line 114. I get the following errors:

[2015-02-03 14:52:21,180] WARN  org.eclipse.jetty.server.Response : Committed before 403 null
[2015-02-03 14:52:21,181] WARN  org.eclipse.jetty.servlet.ServletHandler : /login
java.lang.IllegalStateException: Committed
at org.eclipse.jetty.server.Response.resetBuffer(Response.java:1246)
at org.eclipse.jetty.server.Response.sendError(Response.java:554)
at org.eclipse.jetty.server.Response.sendError(Response.java:542)
at com.google.gerrit.httpd.auth.container.HttpLoginServlet.doGet(HttpLoginServlet.java:124)
I believe this error means that you tried to set a response code on the HTTP response object, after it was already sent to the client.

Chris Harris

unread,
Feb 5, 2015, 8:22:24 AM2/5/15
to Edwin Kempin, Luca Milanesio, snyh xia, Repo and Gerrit Discussion
On Thu, Feb 5, 2015 at 7:42 AM, Edwin Kempin <edwin....@gmail.com> wrote:


2015-02-03 21:03 GMT+01:00 Chris Harris <chris....@kitware.com>:
OK, I have pushed what I have so far:


I am still have problems with doing a redirect at line 114. I get the following errors:

[2015-02-03 14:52:21,180] WARN  org.eclipse.jetty.server.Response : Committed before 403 null
[2015-02-03 14:52:21,181] WARN  org.eclipse.jetty.servlet.ServletHandler : /login
java.lang.IllegalStateException: Committed
at org.eclipse.jetty.server.Response.resetBuffer(Response.java:1246)
at org.eclipse.jetty.server.Response.sendError(Response.java:554)
at org.eclipse.jetty.server.Response.sendError(Response.java:542)
at com.google.gerrit.httpd.auth.container.HttpLoginServlet.doGet(HttpLoginServlet.java:124)
I believe this error means that you tried to set a response code on the HTTP response object, after it was already sent to the client.
Thanks, that makes sense I think, so after I have done the sendRedirect(...) I need to return so the rest of filter chain is not executed ( which I think is try to set the status code ).

Chris  
 

haris tanvir

unread,
May 9, 2016, 2:02:09 AM5/9/16
to Repo and Gerrit Discussion, ameya....@clogeny.com
Hi ameya,
I am facing the same issue. How did you resolve it?

Thanks

Haris Tanvir

On Thursday, September 26, 2013 at 8:22:24 PM UTC+5, Ameya Varade wrote:
Hi,
Thanks for the reply.

listing of 
$GERRIT_SITE/lib --> github-oauth-2.8-SNAPSHOT.jar

$GERRIT_SITE/plugins --> commit-message-length-validator.jar  github.jar  replication.jar  reviewnotes.jar

github.jar(github-plugin-2.8-SNAPSHOT.jar) is the plugin jar.

and here is the gerrit.config

[gerrit]
        basePath = git
        canonicalWebUrl = http://canonicalWebUrl:8080
[database]
        type = h2
        database = db/ReviewDB
[auth]
        type = HTTP
        httpHeader = GITHUB_USER
[sendemail]
        smtpServer = localhost
[container]
        user = root
        javaHome = /usr/java/jdk1.7.0_21/jre
[sshd]
        listenAddress = *:29418
[httpd]
        listenUrl = http://*:8080/
        filterClass = com.googlesource.gerrit.plugins.github.oauth.OAuthFilter
[cache]
        directory = cache
[github]
        url = https://github.com
        clientId = 12345
        clientSecret = 1234567890


Best regards,
Ameya

On Thursday, September 26, 2013 8:19:36 PM UTC+5:30, lucamilanesio wrote:
Hi Ameya,
you get the error when Gerrit is using HTTP header authentication (in this case GITHUB_USER) whilst no header is provided.

The GitHub integration has two components:
- Plugin (which you have installed)
- Servlet filter (which is possibly missing)

The servlet filter is the one in this case responsible of enriching the HTTP requests with GITHUB_USER header.
(not apache in this case)

Can you post the listing of your $GERRIT_SITE/lib and $GERRIT_SITE/plugins directories ?

HTH

Luca.

On 26 Sep 2013, at 15:44, Ameya Varade <ameya....@clogeny.com> wrote:

Hi, 
I am trying to integrate gerrit with github.  I am using this [https://gerrit.googlesource.com/plugins/github/+/62512fd78b4def9d6f3809fc700e0bca199ec24f] revision of a gerrit plugin for github [https://gerrit.googlesource.com/plugins/github/]
This is the article I am referring to. http://www.packtpub.com/article/using-gerrit-with-github
During gerrit init the wizard prompts for gerrit integration setup which goes as expected. But it throws a configuration error if I hit the public gerrit page from the browser.
I am not using apache. It's just gerrit served from jetty. Does anybody know what's wrong here?


Configuration Error

Check the HTTP server's authentication settings.

The HTTP server did not provide the username in the GITHUB_USER header when it forwarded the request to Gerrit Code Review.

If the HTTP server is Apache HTTPd, check the proxy configuration includes an authorization directive with the proper location, ensuring it ends with '/':

<VirtualHost hostname:8080>
    ServerName hostname.com

    ProxyRequests Off
    ProxyVia Off
    ProxyPreserveHost On

    <Proxy *>
          Order deny,allow
          Allow from all
    </Proxy>

<Location /login/> AuthType Basic AuthName "Gerrit Code Review" Require valid-user ... </Location>
AllowEncodedSlashes On ProxyPass / http://.../ nodecode </VirtualHost>


--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Bruno Moraes BVA Consultoria

unread,
Aug 9, 2021, 3:00:01 PM8/9/21
to Repo and Gerrit Discussion
Hi guys, I am facing the same issue that Ameya Varade reported:
error-gerrit-noapache.png

And I am not using Apache either....

You guys have an idea how to solve it?

Really appreciate.
Thanks!

Luca Milanesio

unread,
Aug 9, 2021, 3:51:53 PM8/9/21
to Bruno Moraes BVA Consultoria, Luca Milanesio, Repo and Gerrit Discussion


> On 9 Aug 2021, at 22:00, Bruno Moraes BVA Consultoria <br...@bvaconsultoria.com.br> wrote:
>
> Hi guys, I am facing the same issue that Ameya Varade reported:
> <error-gerrit-noapache.png>
>
> And I am not using Apache either....
>
> You guys have an idea how to solve it?

I guess you forgot to add the GitHub login servlet filter to the gerrit.config?

Example:

[httpd]
filterClass = com.googlesource.gerrit.plugins.github.oauth.OAuthFilter

HTH

Luca.
> To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/1488a333-ba61-47f9-bc40-8996f04a12e0n%40googlegroups.com.
> <error-gerrit-noapache.png>

Lekan Swansons

unread,
May 5, 2022, 12:33:43 AM5/5/22
to Repo and Gerrit Discussion
Hi lucamilanesio

I am wondering if this filterClass = com.googlesource.gerrit.plugins.github.oauth.OAuthFilter is still working. I know you're busy but if you could help I would really appreciate it.
When i add this line to gerrit.config gerrit fails to start
Without this its starts but i can't log in to the github with the http method. I can log in to github if i select oauth and it redirects me to github page without and issue.
I am however a bit sceptical of using this method as I don't know if it will allow me to complete the rest of the steps to get full replication and mirroring of my github repository.

I have gerrit running on ubuntu server on a raspberry pi without apache installed. 

This is my etc/gerrit-config

[gerrit]
    basePath = git
    canonicalWebUrl = http://x.x.x.x:9090/  
    serverId = 6f093015-1fe1-482d-b587-975691cd0a8c
[container]
    javaOptions = "-Dflogger.backend_factory=com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance"
    javaOptions = "-Dflogger.logging_context=com.google.gerrit.server.logging.LoggingContext#getInstance"
    user = laykon
    javaHome = /usr/lib/jvm/java-11-openjdk-arm64
[index]
    type = lucene
[auth]
    type = HTTP
    gitBasicAuthPolicy = HTTP
    loginUrl = /login
    logoutUrl = /oauth/reset
    httpHeader = GITHUB_USER
[receive]
    enableSignedPush = false
[sendemail]
    smtpServer = localhost

[sshd]
    listenAddress = *:29418
[httpd]
    listenUrl = http://0.0.0.0:8080/
    #filterClass = com.googlesource.gerrit.plugins.github.oauth.OAuthFilter #commented this out as gerrit fails to launch with this line in it
[cache]
    directory = cache
[plugins]
    allowRemoteAdmin = true
[plugin-manager]
    jenkinsUrl = https://gerrit-ci.gerritforge.com/
[user]
    name = Gerrit
[log]
    jsonLogging = true
[plugin "gerrit-oauth-provider-github-oauth"] this was created by the git plugin
    client-id = 7ed38703d0ecf4693862
    fix-legacy-user-id = true

[github]
    url = https://github.com
        apiUrl = https://api.github.com
    client-id = 7ed38703d0ecf4693862

I get this issue like everyone else

The HTTP server did not provide the username in the GITHUB_USER header when it forwarded the request to Gerrit Code Review.

If the HTTP server is Apache HTTPd, check the proxy configuration includes an authorization directive with the proper location, ensuring it ends with '/':


Any help would be appreciated. I have the out jar in my $GERRIT_SITE/lib folder

ubuntu@ubuntu:~/gerrit_home$ ls lib/
gerrit-oauth-provider.jar


any help would be appreciated.

Luca Milanesio

unread,
May 5, 2022, 6:57:54 AM5/5/22
to Repo and Gerrit Discussion, Luca Milanesio


On 5 May 2022, at 02:12, Lekan Swansons <lekans...@gmail.com> wrote:

Hi lucamilanesio

Hi, my name is Luca (like in the Suzanne Vega’s song).


I am wondering if this filterClass = com.googlesource.gerrit.plugins.github.oauth.OAuthFilter is still working.

Well, we use it on GerritHub.io and it works as expected.

I know you're busy but if you could help I would really appreciate it.
When i add this line to gerrit.config gerrit fails to start

What does it say when it fails?

Without this its starts but i can't log in to the github with the http method.

Sure, because the OAuth handshake needs to be done by the filter.
Which issue are you getting?


The HTTP server did not provide the username in the GITHUB_USER header when it forwarded the request to Gerrit Code Review.



That is because you’ve disabled the filter and therefore there isn’t any authentication header set.

If the HTTP server is Apache HTTPd, check the proxy configuration includes an authorization directive with the proper location, ensuring it ends with '/':


Any help would be appreciated. I have the out jar in my $GERRIT_SITE/lib folder

ubuntu@ubuntu:~/gerrit_home$ ls lib/
gerrit-oauth-provider.jar


any help would be appreciated.



Sure, can you answer the above questions?

HTH

Luca.

Lekan Swansons

unread,
May 5, 2022, 7:55:45 AM5/5/22
to Repo and Gerrit Discussion
Hi Luca,

I really appreciate you taking the time to reply.

I think might be using the wrong oauth jar. I tried building the github-jar and github-oauth from here (https://gerrit.googlesource.com/plugins/github/) with maven but to no avail.

I think maybe thats why the filter isn't working. When i build the jar, i get an error saying parent pom is missing.

I also tried building without parent pom but then i get some other dependency issues with some of the dependencies.


I guess my question is if the filterclass is still working and i must be using the wrong oauth jar, how do i get the jar or build the jar without it failing?

regards 

Lekan

Luca Milanesio

unread,
May 5, 2022, 8:04:03 AM5/5/22
to Repo and Gerrit Discussion, Luca Milanesio

On 5 May 2022, at 12:55, Lekan Swansons <lekans...@gmail.com> wrote:

Hi Luca,

I really appreciate you taking the time to reply.

No problem, please avoid top-posting and add your comments in-line with the reply, as it makes easier for others to follow the conversation.


I think might be using the wrong oauth jar. I tried building the github-jar and github-oauth from here (https://gerrit.googlesource.com/plugins/github/) with maven but to no avail.

I think maybe thats why the filter isn't working. When i build the jar, i get an error saying parent pom is missing.

I also tried building without parent pom but then i get some other dependency issues with some of the dependencies.

Why don’t you use the already built jars from the Gerrit-CI? (See [1]).


I can log in to github if i select oauth and it redirects me to github page without and issue.

Cool, so that is working as expected.

I am however a bit sceptical of using this method

That’s how OAuth works, how are you supposed to login otherwise?

as I don't know if it will allow me to complete the rest of the steps to get full replication and mirroring of my github repository.

That doesn’t have anything to do with the OAuth handshake.
Can you clarify what isn’t working then?


I have gerrit running on ubuntu server on a raspberry pi without apache installed. 

That isn’t relevant, it should work as long as you have a JVM on it.
You mentioned that OAuth is working and you’re getting redirected and logged in in Gerrit.
Can you clarify what the issue that “everyone else” is getting?

HTH

Luca.

References:

Lekan Swansons

unread,
May 5, 2022, 8:50:20 AM5/5/22
to Repo and Gerrit Discussion
            No problem, please avoid top-posting and add your comments in-line with the reply, as it makes easier for others to follow the conversation.

Sorry still new here my apologies. 

            Why don’t you use the already built jars from the Gerrit-CI? (See [1]).
I tried searching for it before but i entered github instead of plugins-github so i didnt find it. I will be using this now though

            That’s how OAuth works, how are you supposed to login otherwise?

I understand this, I was simply trying to avoid deviating from the steps in the article i was reading in case it affects future configurations. In the article it said select http authentication method. 
I guess the issue was most likely not having the correct oauth jar in the lib folder. 

            That doesn’t have anything to do with the OAuth handshake.
            Can you clarify what isn’t working then?

Basically gerrit doesn't work if i select http authentication method and add the filterclass. When i do bin/gerrrit.sh start, it fails. if i comment out the filter class, it starts but i get the http_server did not provide username error.

regards

LA 

Luca Milanesio

unread,
May 5, 2022, 9:20:25 AM5/5/22
to Repo and Gerrit Discussion, Luca Milanesio

On 5 May 2022, at 13:50, Lekan Swansons <lekans...@gmail.com> wrote:

            No problem, please avoid top-posting and add your comments in-line with the reply, as it makes easier for others to follow the conversation.

Sorry still new here my apologies. 

No problem, but why do you still keep on top-posting?
Just reply to the message in-line below.


            Why don’t you use the already built jars from the Gerrit-CI? (See [1]).
I tried searching for it before but i entered github instead of plugins-github so i didnt find it. I will be using this now though

+1


            That’s how OAuth works, how are you supposed to login otherwise?

I understand this, I was simply trying to avoid deviating from the steps in the article i was reading in case it affects future configurations. In the article it said select http authentication method. 

Can you provide the link to the article you’ve read?

I guess the issue was most likely not having the correct oauth jar in the lib folder. 

            That doesn’t have anything to do with the OAuth handshake.
            Can you clarify what isn’t working then?

Basically gerrit doesn't work if i select http authentication method and add the filterclass. When i do bin/gerrrit.sh start, it fails.

Can you provide the failure you have?
(Try to run bin/gerrit.sh run and it will show all errors on the output)

if i comment out the filter class, it starts but i get the http_server did not provide username error.

You cannot have OAuth without the filter class, otherwise you have no OAuth handshake.

HTH

Luca.

Reply all
Reply to author
Forward
0 new messages