Rename gerrit-base to gerrit-setup

Make gerrit-setup include only the gerrit project.  This will
run the playbook which sets up the git repos, but we will add
a new branch-aware job that inherits from this to the gerrit
repo to include the appropriate repos as required-projects.

Then add a gerrit-build-base job which builds gerrit itself.
This holds the playbook for building gerrit and any other
configuration necessary, but it does not add the required-projects
(ie, the core plugins) because they are also branch specific.

It is temporarily parented on gerrit-setup, but will be reparented
to gerrit-base once that job exists.

The gerrit-build job itself will be defined in the gerrit repo
but inherit from gerrit-build-base.  That job will have branch
variants for all supported gerrit branches, which the appropriate
list of required-projects for each.

A future change will add test jobs to this repo which will run
gerrit-base on changes to this repo to test changes to the main
part of the job.

Change-Id: Ib676f79593390d69935c1b9f5624b0c7fa1c6f90
diff --git a/playbooks/gerrit-base/pre.yaml b/playbooks/gerrit-setup/pre.yaml
similarity index 100%
rename from playbooks/gerrit-base/pre.yaml
rename to playbooks/gerrit-setup/pre.yaml
diff --git a/playbooks/gerrit/build.yaml b/playbooks/gerrit/build.yaml
new file mode 100644
index 0000000..514def1
--- /dev/null
+++ b/playbooks/gerrit/build.yaml
@@ -0,0 +1,5 @@
+- name: Build Gerrit
+  hosts: all
+  roles:
+    - role: bazelisk-build
+      bazelisk_targets: "plugins:core release api"
diff --git a/playbooks/test-gerrit-base.yaml b/playbooks/test-gerrit-base.yaml
deleted file mode 100644
index eaa4fcf..0000000
--- a/playbooks/test-gerrit-base.yaml
+++ /dev/null
@@ -1,20 +0,0 @@
-- hosts: all
-  tasks:
-    - name: List submodule git dir
-      command: "ls src/gerrit.googlesource.com/gerrit/{{ item }}/.git"
-      args:
-        chdir: "{{ ansible_user_dir }}"
-      loop:
-        - modules/jgit
-        - plugins/codemirror-editor
-        - plugins/commit-message-length-validator
-        - plugins/delete-project
-        - plugins/download-commands
-        - plugins/gitiles
-        - plugins/hooks
-        - plugins/plugin-manager
-        - plugins/replication
-        - plugins/reviewnotes
-        - plugins/singleusergroup
-        - plugins/webhooks
-        - polymer-bridges
diff --git a/playbooks/test-gerrit-setup.yaml b/playbooks/test-gerrit-setup.yaml
new file mode 100644
index 0000000..01022e6
--- /dev/null
+++ b/playbooks/test-gerrit-setup.yaml
@@ -0,0 +1,8 @@
+- hosts: all
+  tasks:
+    - name: List submodule git dir
+      command: "ls src/gerrit.googlesource.com/gerrit/{{ item }}/.git"
+      args:
+        chdir: "{{ ansible_user_dir }}"
+      loop:
+        - modules/jgit
diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml
index 6d9c908..dde5e53 100644
--- a/zuul.d/jobs.yaml
+++ b/zuul.d/jobs.yaml
@@ -1,30 +1,47 @@
 - job:
-    name: gerrit-base
+    name: gerrit-setup
     description: |
       Base job for building Gerrit
 
-      This job sets up all the repos which are required for a gerrit
-      build.
-    pre-run: playbooks/gerrit-base/pre.yaml
+      This job sets up any supplied repos which are required for any
+      kind of gerrit-related build (plugins or Gerrit itself).
+
+      However, it does not include all of the required repos; for
+      that, see :zuul:job:`gerrit-base` which inherits from this and
+      adds branch-appropriate required-projects.
+    pre-run: playbooks/gerrit-setup/pre.yaml
     required-projects:
       - gerrit
-      - jgit
-      - plugins/codemirror-editor
-      - plugins/commit-message-length-validator
-      - plugins/delete-project
-      - plugins/download-commands
-      - plugins/gitiles
-      - plugins/hooks
-      - plugins/plugin-manager
-      - plugins/replication
-      - plugins/reviewnotes
-      - plugins/singleusergroup
-      - plugins/webhooks
-      - polymer-bridges
+
+- job:
+    name: gerrit-build-base
+    parent: gerrit-setup
+    description: |
+      Build Gerrit
+
+      This job sets up submodule repos in a Gerrit tree and runs
+      bazelisk.  However, it does not include all of the required
+      repos; for that, see :zuul:job:`gerrit-build` which inherits
+      from this and adds required-projects.
+
+      Responds to these variables:
+
+      .. zuul:jobvar:: baselisk_targets
+
+         The bazelisk targets to build.  Defaults to ":release".
+
+      .. zuul:jobvar:: baselisk_test_targets
+
+         The bazelisk targets to test.
+    run: playbooks/gerrit/build.yaml
+    timeout: 3600
+    vars:
+      bazelisk_targets: ":release"
+      zuul_work_dir: "{{ ansible_user_dir }}/src/gerrit.googlesource.com/gerrit"
 
 - job:
     name: gerrit-plugin-build
-    parent: gerrit-base
+    parent: gerrit-setup
     description: |
       Builds a Gerrit plugin in-tree
 
@@ -49,3 +66,6 @@
       gerrit_plugin: "{{ zuul.project.short_name }}"
       bazelisk_targets: "plugins/{{ gerrit_plugin }}:{{ gerrit_plugin }}"
       zuul_work_dir: "{{ ansible_user_dir }}/src/gerrit.googlesource.com/gerrit"
+    # Temporarily add jgit here until we reparent on gerrit-base
+    required-projects:
+      - jgit
diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml
index aa8e103..ce9587a 100644
--- a/zuul.d/project.yaml
+++ b/zuul.d/project.yaml
@@ -3,6 +3,6 @@
       jobs:
         - test-ensure-bazelisk
         - test-ensure-java
-        - test-gerrit-base
+        - test-gerrit-setup
         - test-install-build-essential
         - test-gerrit-plugin-build
diff --git a/zuul.d/test-jobs.yaml b/zuul.d/test-jobs.yaml
index 2067e6f..fa0a196 100644
--- a/zuul.d/test-jobs.yaml
+++ b/zuul.d/test-jobs.yaml
@@ -22,15 +22,29 @@
       - playbooks/test-install-build-essential.yaml
 
 - job:
-    name: test-gerrit-base
-    parent: gerrit-base
-    run: playbooks/test-gerrit-base.yaml
+    name: test-gerrit-setup
+    parent: gerrit-setup
+    run: playbooks/test-gerrit-setup.yaml
+    required-projects:
+      - jgit
+      - plugins/codemirror-editor
+      - plugins/commit-message-length-validator
+      - plugins/delete-project
+      - plugins/download-commands
+      - plugins/gitiles
+      - plugins/hooks
+      - plugins/plugin-manager
+      - plugins/replication
+      - plugins/reviewnotes
+      - plugins/singleusergroup
+      - plugins/webhooks
+      - polymer-bridges
     files:
       - roles/ensure-bazelisk/.*
       - roles/ensure-java/.*
       - roles/prepare-gerrit-repos/.*
       - roles/install-build-essential/.*
-      - playbooks/test-gerrit-base.yaml
+      - playbooks/test-gerrit-setup.yaml
 
 - job:
     name: test-gerrit-plugin-build