davido / gerrit-oauth-provider

OAuth2 authentication provider for Gerrit Code Review. Please upload changes for review to: https://gerrit-review.googlesource.com/#/admin/projects/plugins/oauth
Apache License 2.0
140 stars 84 forks source link

Question about release plan for gerrit 3.0.0 compatible plugin #126

Open gon3456 opened 5 years ago

gon3456 commented 5 years ago

I've currently used gerrit 2.16.8 and your plugin 2.16.1. There are no problems for the above combination.

I want to upgrade the gerrit version to 3.0.0. As a trial, I upgraded gerrit version to 3.0.0 then I confirmed that google oauth signing in fails with "server error". It seems that there are no compatibilities to 3.0.0.

So, could you please tell me your release plan about 3.0.0 compatible plugin if you have any idea?

davido commented 5 years ago

Can you be more specific about "server error"? Can you provide a stack trace?

gon3456 commented 5 years ago

Reproduction procedure:

  1. install docker to your linux environment.

  2. deploy gerrit 3.0.0 by using docker image on any linux. (I've tried on ubuntu 19.04) $ docker pull gerritcodereview/gerrit $ docker run -tid -p 8080:8080 -p 29418:29418 gerritcodereview/gerrit Note: you may change CANONICAL_WEB_URL enviroment variable with docker-compose.yaml due to resolving oauth callback process.

  3. install your latest plugin (2.16.1) to the container. $ docker exec -it YOUR_GERRIT_CONTAINER_ID /bin/bash

--- in the container's shell ---

$ scp HOST_USER_NAME@HOST_IP_ADDRESS:/path/to/gerrit-oauth-provider.jar /var/gerrit/plugins/ $ cd /var/gerrit/bin/ $ java -jar /var/gerrit/bin/gerrit.war init -d /var/gerrit

An error occurs at the end of installation but it can be ignored. (the plugin should be enabled after the next start) I've attached the installation log. installation.log

$ exit

  1. restart the gerrit container

  2. access to the gerrit web url with web browser

  3. sign in with Google

  4. after sigining in, "Server Error" message is shown on the browser with the below URL:

    http://MY_DOMAIN.com:8080/oauth?state=PlF43Si02TpArYbRLzv5C133x-qZQNqhxGoJAy-kJ_I&code=4/WAEz-9ZccSBWxfY3vTOkOJPcdXdrHfjqDPIGaksoP-ERxISOLJ0sCxuOcooLvb6y-jwntVIeR4y_V2Pn4ZVvP6w&scope=email%20profile%20https://www.googleapis.com/auth/userinfo.email%20https://www.googleapis.com/auth/userinfo.profile

$ docker exec -it YOUR_GERRIT_CONTAINER_ID /bin/bash

--- in the container's shell ---

$ cat /var/gerrit/logs/httpd_log

MY_IP_ADDR - - [28/May/2019:08:12:44 +0000] "GET / HTTP/1.1" 302 - 62 - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
MY_IP_ADDR - - [28/May/2019:08:12:44 +0000] "GET /login/%23%2F?account_id=1000000 HTTP/1.1" 302 - 27 - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
MY_IP_ADDR - - [28/May/2019:08:13:49 +0000] "GET /oauth?state=PlF43Si02TpArYbRLzv5C133x-qZQNqhxGoJAy-kJ_I&code=4/WAEz-9ZccSBWxfY3vTOkOJPcdXdrHfjqDPIGaksoP-ERxISOLJ0sCxuOcooLvb6y-jwntVIeR4y_V2Pn4ZVvP6w&scope=email%20profile%20https://www.googleapis.com/auth/userinfo.email%20https://www.googleapis.com/auth/userinfo.profile HTTP/1.1" 500 12 580 - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"

Note:

davido commented 5 years ago

Thanks, you are right:

java.lang.NoClassDefFoundError: com/google/gerrit/server/OutputFormat
    at com.googlesource.gerrit.plugins.oauth.GoogleOAuthService.getUserInfo(GoogleOAuthService.java:109)
    at com.google.gerrit.httpd.auth.oauth.OAuthSession.login(OAuthSession.java:105)
    at com.google.gerrit.httpd.auth.oauth.OAuthWebFilter.doFilter(OAuthWebFilter.java:105)
    at com.google.gerrit.httpd.RunAsFilter.doFilter(RunAsFilter.java:120)
    at com.google.gerrit.httpd.AllRequestFilter$FilterProxy$1.doFilter(AllRequestFilter.java:133)
    at com.google.gerrit.httpd.AllRequestFilter$FilterProxy.doFilter(AllRequestFilter.java:135)
    at com.google.gerrit.httpd.RequestMetricsFilter.doFilter(RequestMetricsFilter.java:57)
    at com.google.gerrit.httpd.RequestContextFilter.doFilter(RequestContextFilter.java:69)
    at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:121)
    at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:133)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at com.googlesource.gerrit.plugins.ootb.FirstTimeRedirect.doFilter(FirstTimeRedirect.java:63)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1588)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1557)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
    at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:56)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.Server.handle(Server.java:502)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: com.google.gerrit.server.OutputFormat
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:817)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 40 more

The releases 2.16.x and 3.0.x are not compatible.

powderluv commented 5 years ago

I hit the same issue. Is there a 3.0.0 pre-built available ? Or should we build from source

powderluv commented 5 years ago

Get the latest oauth.jar from https://gerrit-ci.gerritforge.com/job/plugin-oauth-bazel-stable-3.0/ and it works. Make sure you remove the old gerrit-oauth-provider.jar from your plugins/

davido commented 5 years ago

Correct. You also have to adjust the configuration correspondingly.