test: Fix docker-tests for in-tree/master

When running the docker tests against master we need to depend on the
in-tree WAR so that the runtime APIs match what we compiled against. In
order to depend on the WAR we need to add the polymer-bridges project
(core submodule) as a required project so that the core build is
successful.

This also requires us to remove all other plugins from the 3.9 docker
image to avoid any incompatiblities they may have with master.

As a result of this change, the bazel test docker-tests target now only
works with an in-tree build on the master branch. This is an unfortunate
difference compared to the stable branches, but it makes sense given
that we need a Gerrit WAR with compatible runtime APIs running in the
container.

Change-Id: Id4484243bd526338053afb8ad1d1f15410589c39
diff --git a/.zuul.yaml b/.zuul.yaml
index 6e83fbf..2e76033 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -5,6 +5,8 @@
         - tools/playbooks/install_maven.yaml
         - tools/playbooks/install_docker.yaml
         - tools/playbooks/install_python3-distutils.yaml
+    required-projects:
+      - polymer-bridges
     vars:
         bazelisk_test_targets: "plugins/task/lint_test plugins/task/..."
 
diff --git a/BUILD b/BUILD
index 0a0773f..9bd469c 100644
--- a/BUILD
+++ b/BUILD
@@ -91,8 +91,8 @@
     name = "docker-tests",
     size = "medium",
     srcs = ["test/docker/run.sh"],
-    args = ["--task-plugin-jar", "$(location :task)", "--names-factory-provider-plugin-jar", "$(location :names-factory-provider)"],
-    data = [plugin_name, test_factory_provider_plugin_name] + glob(["test/**"]) + glob(["src/main/resources/Documentation/*"]),
+    args = ["--gerrit-war", "$(location //:gerrit.war)", "--task-plugin-jar", "$(location :task)", "--names-factory-provider-plugin-jar", "$(location :names-factory-provider)"],
+    data = ["//:gerrit.war", plugin_name, test_factory_provider_plugin_name] + glob(["test/**"]) + glob(["src/main/resources/Documentation/*"]),
     local = True,
     tags = ["docker"],
 )
diff --git a/test/docker/gerrit/Dockerfile b/test/docker/gerrit/Dockerfile
index e41d8f5..7a03f35 100755
--- a/test/docker/gerrit/Dockerfile
+++ b/test/docker/gerrit/Dockerfile
@@ -1,6 +1,7 @@
 FROM gerritcodereview/gerrit:3.9.1-ubuntu22
 
 ENV GERRIT_SITE /var/gerrit
+RUN rm -rf "$GERRIT_SITE/plugins" && mkdir "$GERRIT_SITE/plugins"
 RUN git config -f "$GERRIT_SITE/etc/gerrit.config" auth.type \
     DEVELOPMENT_BECOME_ANY_ACCOUNT
 RUN git config -f "$GERRIT_SITE/etc/gerrit.config" --add container.javaOptions \