Merge branch 'stable-3.0' into stable-3.1

* stable-3.0:
  setup_local_env: Fix README markdown lint warnings
  dockerised_local_env: Formalize slashes for git-ignored folders
  Sort .gitignore files using LC_COLLATE=C like core
  dockerised_local_env: Fix ssh private key permission
  dockerised_local_env: Make gerrit-1 ssh host known
  dockerised_local_env: Add replication.jar as a lib
  dockerised_local_env: Add wget to README prerequisites

Change-Id: I5db9b0986977d9ad76f04abe4244ac3810a38ed4
diff --git a/.gitignore b/.gitignore
index dbd3157..73f4353 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,12 +1,15 @@
+# LC_COLLATE=C sort
+
 .DS_Store
+/.apt_generated/
 /.classpath
+/.primary_build_tool
 /.project
 /.settings/
-/.primary_build_tool
+
 /bazel-bin
 /bazel-out
 /bazel-reviewers
 /bazel-testlogs
-/bazel-multi-site
+
 /eclipse-out/
-/.apt_generated/
diff --git a/dockerised_local_env/.gitignore b/dockerised_local_env/.gitignore
index c88a11c..36a108e 100644
--- a/dockerised_local_env/.gitignore
+++ b/dockerised_local_env/.gitignore
@@ -1,25 +1,28 @@
-gerrit-1/plugins
-gerrit-1/db
-gerrit-1/git
-gerrit-1/logs
-gerrit-1/index
-gerrit-1/data
-gerrit-1/bin
-gerrit-1/etc
-gerrit-1/tmp
-gerrit-1/lib
-gerrit-1/ssh/known_hosts
-gerrit-2/plugins
-gerrit-2/db
-gerrit-2/git
-gerrit-2/logs
-gerrit-2/index
-gerrit-2/data
-gerrit-2/bin
-gerrit-2/etc
-gerrit-2/tmp
-gerrit-2/lib
-gerrit-2/ssh/known_hosts
-gerrit-2/bin
-syslog-sidecar/logs
-syslog-sidecar/socket
+# LC_COLLATE=C sort
+
+/gerrit-1/bin/
+/gerrit-1/data/
+/gerrit-1/db/
+/gerrit-1/etc/
+/gerrit-1/git/
+/gerrit-1/index/
+/gerrit-1/lib/
+/gerrit-1/logs/
+/gerrit-1/plugins/
+/gerrit-1/ssh/known_hosts
+/gerrit-1/tmp/
+
+/gerrit-2/bin/
+/gerrit-2/data/
+/gerrit-2/db/
+/gerrit-2/etc/
+/gerrit-2/git/
+/gerrit-2/index/
+/gerrit-2/lib/
+/gerrit-2/logs/
+/gerrit-2/plugins/
+/gerrit-2/ssh/known_hosts
+/gerrit-2/tmp/
+
+/syslog-sidecar/logs/
+/syslog-sidecar/socket/
diff --git a/dockerised_local_env/Makefile b/dockerised_local_env/Makefile
index 0b6b7e3..f02695b 100644
--- a/dockerised_local_env/Makefile
+++ b/dockerised_local_env/Makefile
@@ -35,7 +35,8 @@
 
 plugin_multi_site: prepare
 	$(WGET) $(CI_URL)/plugin-multi-site-bazel-stable-2.16/lastSuccessfulBuild/artifact/bazel-bin/plugins/multi-site/multi-site.jar -P $(GERRIT_1_LIB_DIRECTORY)
-	cp $(GERRIT_1_LIB_DIRECTORY)/multi-site.jar $(GERRIT_2_LIB_DIRECTORY)/multi-site.jar
+	cp $(GERRIT_1_PLUGINS_DIRECTORY)/replication.jar $(GERRIT_1_LIB_DIRECTORY)
+	cp $(GERRIT_1_LIB_DIRECTORY)/*.jar $(GERRIT_2_LIB_DIRECTORY)
 
 plugin_healthcheck: prepare
 	$(WGET) $(CI_URL)/plugin-healthcheck-bazel-stable-2.16/lastSuccessfulBuild/artifact/bazel-bin/plugins/healthcheck/healthcheck.jar -P $(GERRIT_1_PLUGINS_DIRECTORY)
diff --git a/dockerised_local_env/README.md b/dockerised_local_env/README.md
index 099be72..8c2bf41 100644
--- a/dockerised_local_env/README.md
+++ b/dockerised_local_env/README.md
@@ -2,13 +2,19 @@
 
 ## Prerequisites
 
- * envsubst:
+* envsubst:
 
 ```bash
 brew install gettext
 brew link --force gettext
 ```
 
+* wget:
+
+```bash
+brew install wget
+```
+
 ## Instructions
 
 The docker compose provided in this directory is meant to orchestrate the spin up
diff --git a/dockerised_local_env/gerrit-2/docker-entrypoint.sh b/dockerised_local_env/gerrit-2/docker-entrypoint.sh
index 532377c..06f928f 100755
--- a/dockerised_local_env/gerrit-2/docker-entrypoint.sh
+++ b/dockerised_local_env/gerrit-2/docker-entrypoint.sh
@@ -11,7 +11,11 @@
 
   echo "Waiting for gerrit1 server to become available."
   sleep 120
+
+  chmod go-r /var/gerrit/.ssh/id_rsa
+  ssh-keyscan -t rsa -p 29418 gerrit-1 > /var/gerrit/.ssh/known_hosts
   ssh -p 29418 admin@gerrit-1 replication start
+
   echo "Waiting for replication to complete."
   sleep 30
 fi
diff --git a/setup_local_env/README.md b/setup_local_env/README.md
index 2df0c2b..441f98d 100644
--- a/setup_local_env/README.md
+++ b/setup_local_env/README.md
@@ -2,27 +2,35 @@
 
 This script configures a full environment to simulate a Gerrit Multi-Site setup.
 The environment is composed by:
- - 2 gerrit instances deployed by default in /tmp
- - 1 kafka node and 1 zookeeper node
- - 1 HA-PROXY
+
+- 2 gerrit instances deployed by default in /tmp
+- 1 kafka node and 1 zookeeper node
+- 1 HA-PROXY
 
 ## Requirements
- - java
- - docker and docker-compose
- - wget
- - envsubst
- - haproxy
+
+- java
+- docker and docker-compose
+- wget
+- envsubst
+- haproxy
 
 ## Examples
+
 Simplest setup with all default values and cleanup previous deployment
+
 ```bash
 sh setup_local_env/setup.sh --release-war-file /path/to/release.war --multisite-plugin-file /path/to/multi-site.jar
 ```
+
 Cleanup the previous deployments
+
 ```bash
 sh setup_local_env/setup.sh --just-cleanup-env true
 ```
+
 Help
+
 ```bash
 Usage: sh setup.sh [--option ]
 
@@ -52,6 +60,7 @@
 ```
 
 ## Limitations
-	- Assumes the ssh replication is done always on port 22 on both instances
-	- When cloning projects via ssh, public keys entries are added to `known_hosts`
-		- Clean up the old entries when doing a new deploymet, otherwise just use HTTP
\ No newline at end of file
+
+- Assumes the ssh replication is done always on port 22 on both instances
+- When cloning projects via ssh, public keys entries are added to `known_hosts`
+  - Clean up the old entries when doing a new deployment, otherwise just use HTTP