From 57f9e54ad8885d6ebe48c1da41724e6939da2bfc Mon Sep 17 00:00:00 2001
From: Clark Boylan <clark.boylan@gmail.com>
Date: Fri, 9 Oct 2020 09:52:52 -0700
Subject: [PATCH] Omnibus Gerrit 3.2 changes

These changes are squashed together to simplify applying them to config
management without zuul and ansible running one of these without the
others. We essentially need them all in place at the same time to
accurately reflect the post upgrade state.

We stop blocking /p/ in gerrit's apache vhost. /p/ is used for
dashboards.

We add a few java options that new gerrit sets by default.

We update the gerrit image in docker compose to 3.2.

We update zuul to use basic auth instead of digest auth when talking to
Gerrit.

Change-Id: I6ea38313544ce1ecbc4cfd914b1f33e77d0d2d03
---
 inventory/service/group_vars/zuul.yaml           | 1 -
 playbooks/roles/gerrit/defaults/main.yaml        | 2 +-
 playbooks/roles/gerrit/templates/gerrit.config   | 3 +++
 playbooks/roles/gerrit/templates/gerrit.vhost.j2 | 7 -------
 4 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/inventory/service/group_vars/zuul.yaml b/inventory/service/group_vars/zuul.yaml
index ec9c290ac5..7bc0b6e680 100644
--- a/inventory/service/group_vars/zuul.yaml
+++ b/inventory/service/group_vars/zuul.yaml
@@ -21,7 +21,6 @@ zuul_connections:
     user: 'zuul'
     sshkey: '/var/lib/zuul/ssh/id_rsa'
     gitweb_url_template: 'https://opendev.org/{project.name}/commit/{sha}'
-    auth_type: 'digest'
 
   - name: 'opendaylight'
     driver: 'gerrit'
diff --git a/playbooks/roles/gerrit/defaults/main.yaml b/playbooks/roles/gerrit/defaults/main.yaml
index a05f919a32..36859e2dd5 100644
--- a/playbooks/roles/gerrit/defaults/main.yaml
+++ b/playbooks/roles/gerrit/defaults/main.yaml
@@ -5,7 +5,7 @@ gerrit_site_dir: "{{ gerrit_home_dir }}/review_site"
 gerrit_run_compose_up: false
 gerrit_run_init: false
 gerrit_packed_git_open_files: 4096
-gerrit_container_image: docker.io/opendevorg/gerrit:2.13
+gerrit_container_image: docker.io/opendevorg/gerrit:3.2
 gerrit_container_volumes:
   - /home/gerrit2/review_site/cache:/var/gerrit/cache
   - /home/gerrit2/review_site/etc:/var/gerrit/etc
diff --git a/playbooks/roles/gerrit/templates/gerrit.config b/playbooks/roles/gerrit/templates/gerrit.config
index 21b715b99a..df942244c8 100644
--- a/playbooks/roles/gerrit/templates/gerrit.config
+++ b/playbooks/roles/gerrit/templates/gerrit.config
@@ -39,6 +39,9 @@
 {% if gerrit_heap_limit is defined %}
 	heapLimit = {{ gerrit_heap_limit }}
 {% endif %}
+	javaHome = /usr/local/openjdk-8/jre
+	javaOptions = "-Dflogger.backend_factory=com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance"
+	javaOptions = "-Dflogger.logging_context=com.google.gerrit.server.logging.LoggingContext#getInstance"
 [gc]
 [core]
 	packedGitOpenFiles = {{ gerrit_packed_git_open_files }}
diff --git a/playbooks/roles/gerrit/templates/gerrit.vhost.j2 b/playbooks/roles/gerrit/templates/gerrit.vhost.j2
index 623945b175..c90d551197 100644
--- a/playbooks/roles/gerrit/templates/gerrit.vhost.j2
+++ b/playbooks/roles/gerrit/templates/gerrit.vhost.j2
@@ -61,9 +61,6 @@
   #RewriteCond %{REQUEST_URI} !^/maintenance.html$
   #RewriteRule ^/(.*) /maintenance.html [last,redirect=temporary]
 
-  # TODO remove this when upgrading to Gerrit 2.16. /p/ is used
-  # for project dashboards.
-  ProxyPassMatch ^/p/ !
   ProxyPassMatch ^/robots.txt$ !
   ProxyPassMatch ^/server-status !
   # Comment out these two lines if the maintenance message above is in use
@@ -72,10 +69,6 @@
 
   Alias /robots.txt /home/gerrit2/review_site/static/robots.txt
 
-  # TODO remove this when upgrading to Gerrit 2.16. /p/ is used
-  # for project dashboards.
-  RewriteRule "^/p/.*" "-" [F,L]
-
   <Directory /home/gerrit2/review_site/git/>
     Require all granted
     Order allow,deny