Add Dockerfile for gerrit and monkey patch

The openid support doesn't allow to add custom providers but we like the
convenience of a single click. Take the official docker image and patch
the HTML template. It seems to have changed little over the time, and it
might continue like that...

I have filed https://bugs.chromium.org/p/gerrit/issues/detail?id=8828 so
that we can drop this hack in the future...

Change-Id: I713948fbb93355c2e33e3b92969e2389cb88c938
This commit is contained in:
Holger Hans Peter Freyther 2018-04-24 21:32:26 +08:00 committed by Harald Welte
parent 2f61bf81e9
commit b210f3aa6e
2 changed files with 29 additions and 0 deletions

18
gerrit/Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM gerritcodereview/gerrit
USER root
RUN yum -y install zip unzip patch
RUN \
unzip /var/gerrit/bin/gerrit.war WEB-INF/lib/gerrit-openid-libopenid.jar && \
unzip WEB-INF/lib/gerrit-openid-libopenid.jar com/google/gerrit/httpd/auth/openid/LoginForm.html
COPY add_osmocom.diff /tmp
RUN patch -p0 < /tmp/add_osmocom.diff
RUN \
zip -u WEB-INF/lib/gerrit-openid-libopenid.jar com/google/gerrit/httpd/auth/openid/LoginForm.html && \
zip -u /var/gerrit/bin/gerrit.war WEB-INF/lib/gerrit-openid-libopenid.jar
USER gerrit

11
gerrit/add_osmocom.diff Normal file
View File

@ -0,0 +1,11 @@
--- com/google/gerrit/httpd/auth/openid/LoginForm.html.orig 2018-04-24 21:07:24.000000000 +0800
+++ com/google/gerrit/httpd/auth/openid/LoginForm.html 2018-04-24 21:08:26.000000000 +0800
@@ -70,6 +70,8 @@
<div id="providers">
</div>
+ <div id="provider_osmocom"><a href="?id=https://osmocom.org/openid" id="id_osmocom">Sign in with Osmocom</a></div>
+
<div id="provider_launchpad">
<img height="16" width="16" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAHKSURBVCiRjZI9SFtRGIafc5tiVFCkhUxKBAcLYoPWwE0GEUPBwc0f1MHFoWLBiKABobWtBh2kacFYwUUQRXBoB3EJCVUvyBVrIB1UskTawUGFQOoP5h6H3ki8deg7vuc853zvxyuklORLDUc9QH9nZeAL0AGM+1v0cywSOVANR8uBaaALOOysDLwCYsAp8AaY97fo2RyoqOFooRqOvgUOTMiqJ8AsEA9tuH13IFkcQD1QZHpbQE+bPXEADAK5MSsA1/p+1SMAoTbF9oAh2WYUAcWbz5tThiQE1EsI7VxVzMWvHe2lGWP1RaqgWyKe1g5vjyhAHfBdrCmuWG1zqSHRAS9gFxBQC451/+PdhbqUPSYR00JSAmDLy+IE7ICwZHRkbBQKqMo3lQeW8V/KB5PAMSAtd06Kb7iQf8/vgXuA9/2V9nN7dCKjCNyABlxKmPqx7HQvDjX0HX29bBLIUSlIA4gNT9Bpw/gMtJqPaYD/2evJX5FgTQcwDpQBaeCD8+XZx8aZZFaxYZyYv/4xQS+wFAnWVAOfTAgzRrxxJpkFUHza2IVPG3sHVAMrD+zhFBgAXL0JPZIzhbXkEe+kB+j/nf52V/LexL8lvwVTCpkwGXEEfAAAAABJRU5ErkJggg=="/>
<a href="?id=https://login.launchpad.net/%2Bopenid" id="id_launchpad">Sign in with a Launchpad ID</a>