Merge branch 'stable-3.1'

* stable-3.1:
  Remove unused roles
  Move all the installs in one place
  Create stack to run load tests
  Better resource assignment for dual master
  Propagate master 1 logs to AWS CloudWatch
  Use nested CF template for Task Execution Role
  Bump up Gerrit version to 3.1.6
  Allow slave to run on multiple EC2 instances
  Retry more aggressively to mount EFS
  Don't fail if direcotory exists when starting up cluster

Change-Id: Ibd3e10f4e2c703e9cea8ff5cddf8c5c26c0d728e
diff --git a/common.env b/common.env
index 371577f..0de0fd5 100644
--- a/common.env
+++ b/common.env
@@ -4,10 +4,9 @@
 CLUSTER_KEYS=$(AWS_PREFIX)-cluster-keys
 
 # Gerrit version
-GERRIT_VERSION=3.1
-GERRIT_PATCH=6
+GERRIT_VERSION=3.2
+GERRIT_PATCH=0
 GERRIT_BRANCH=stable-$(GERRIT_VERSION)
-
 # Gerrit CI
 GERRIT_CI=https://gerrit-ci.gerritforge.com/view/Plugins-$(GERRIT_BRANCH)/job
 LAST_BUILD=lastSuccessfulBuild/artifact/bazel-bin/plugins
diff --git a/dual-master/cf-cluster.yml b/dual-master/cf-cluster.yml
index 49530ce..dc8f02e 100644
--- a/dual-master/cf-cluster.yml
+++ b/dual-master/cf-cluster.yml
@@ -167,6 +167,7 @@
           done; (exit $s)
           mkdir -p $DIR_TGT/git
           mkdir -p $DIR_TGT/high-availability
+          mkdir -p $DIR_TGT/events
           chown -R 1000:1000 $DIR_TGT
           cp -p /etc/fstab /etc/fstab.back-$(date +%F)
           echo -e \"$DIR_SRC:/ \t\t $DIR_TGT \t\t nfs \t\t defaults \t\t 0 \t\t 0\" | tee -a /etc/fstab
diff --git a/dual-master/cf-service-master.yml b/dual-master/cf-service-master.yml
index acbdaff..1a4adaa 100644
--- a/dual-master/cf-service-master.yml
+++ b/dual-master/cf-service-master.yml
@@ -77,6 +77,10 @@
       Description: Gerrit git volume name
       Type: String
       Default: gerrit-git-master
+  GerritEventsVolume:
+      Description: Gerrit replication events volume name
+      Type: String
+      Default: gerrit-events-master
   GerritWebsessionsVolume:
       Description: Gerrit git volume name
       Type: String
@@ -171,6 +175,8 @@
                       ContainerPath: /var/gerrit/db
                     - SourceVolume: !Ref GerritLogsVolume
                       ContainerPath: /var/gerrit/logs
+                    - SourceVolume: !Ref GerritEventsVolume
+                      ContainerPath: /var/gerrit/events
                   Cpu: 3072
                   Memory: 9216
                   PortMappings:
@@ -190,6 +196,9 @@
               - Name: !Ref 'GerritGitVolume'
                 Host:
                   SourcePath: "/mnt/efs/gerrit-shared/git"
+              - Name: !Ref 'GerritEventsVolume'
+                Host:
+                  SourcePath: "/mnt/efs/gerrit-shared/events"
               - Name: !Ref 'GerritWebsessionsVolume'
                 Host:
                   SourcePath: "/mnt/efs/gerrit-shared/high-availability"
diff --git a/gerrit/Dockerfile b/gerrit/Dockerfile
index 5586696..aa03945 100644
--- a/gerrit/Dockerfile
+++ b/gerrit/Dockerfile
@@ -1,9 +1,8 @@
-FROM gerritcodereview/gerrit:$GERRIT_VERSION.$GERRIT_PATCH-centos7
+FROM gerritcodereview/gerrit:$GERRIT_VERSION.$GERRIT_PATCH-centos8
 
 USER root
 
-RUN yum install -y https://repo.ius.io/ius-release-el7.rpm \
-    && yum install -y python36u python36u-libs python36u-devel python36u-pip
+RUN  yum install -y python36 python3-libs python36-devel python3-pip
 
 COPY --chown=gerrit:gerrit ssh-config /var/gerrit/.ssh/config
 
diff --git a/gerrit/Makefile b/gerrit/Makefile
index 902e93a..a6d6719 100644
--- a/gerrit/Makefile
+++ b/gerrit/Makefile
@@ -15,12 +15,12 @@
 	|| { echo >&2 "Cannot download metrics-reporter-prometheus plugin: Check internet connection. Aborting"; exit 1; }
 
 	@echo "Downloading javamelody plugin $(GERRIT_BRANCH)"
-	wget $(GERRIT_CI)/plugin-javamelody-bazel-$(GERRIT_BRANCH)/$(LAST_BUILD)/javamelody/javamelody.jar \
+	wget $(GERRIT_CI)/plugin-javamelody-bazel-master-$(GERRIT_BRANCH)/$(LAST_BUILD)/javamelody/javamelody.jar \
 	-O ./plugins/javamelody.jar \
 	|| { echo >&2 "Cannot download javamelody plugin: Check internet connection. Aborting"; exit 1; }
 
 	@echo "Downloading HA plugin $(GERRIT_BRANCH)"
-	wget $(GERRIT_CI)/plugin-high-availability-bazel-$(GERRIT_BRANCH)/$(LAST_BUILD)/high-availability/high-availability.jar \
+	wget $(GERRIT_CI)/plugin-high-availability-bazel-master-$(GERRIT_BRANCH)/$(LAST_BUILD)/high-availability/high-availability.jar \
 	-O ./plugins/high-availability.jar \
 	|| { echo >&2 "Cannot download high-availability plugin: Check internet connection. Aborting"; exit 1; }
 
diff --git a/gerrit/etc/replication.config.template b/gerrit/etc/replication.config.template
index c03a807..814a4a9 100644
--- a/gerrit/etc/replication.config.template
+++ b/gerrit/etc/replication.config.template
@@ -1,6 +1,8 @@
 [replication]
   lockErrorMaxRetries = 30
   maxRetries = 30
+  eventsDirectory = events
+  distributionInterval = 1
 
 [gerrit]
   autoReload = true