diff --git a/playbooks/roles/gerrit/defaults/main.yaml b/playbooks/roles/gerrit/defaults/main.yaml index fd0765d637..8e5bbc1f69 100644 --- a/playbooks/roles/gerrit/defaults/main.yaml +++ b/playbooks/roles/gerrit/defaults/main.yaml @@ -2,6 +2,7 @@ gerrit_id: 3000 gerrit_user_name: gerrit2 gerrit_home_dir: /home/gerrit2 gerrit_site_dir: "{{ gerrit_home_dir }}/review_site" +gerrit_run_compose_up: false gerrit_run_init: false gerrit_container_image: docker.io/opendevorg/gerrit:2.13 gerrit_container_volumes: diff --git a/playbooks/roles/gerrit/tasks/main.yaml b/playbooks/roles/gerrit/tasks/main.yaml index e33c0da916..7966031402 100644 --- a/playbooks/roles/gerrit/tasks/main.yaml +++ b/playbooks/roles/gerrit/tasks/main.yaml @@ -272,19 +272,5 @@ - docker-compose state: present -# TODO(mordred) Make this suck less, like if we could do an init container -# or something just generally less gross. -- name: Run gerrit init - when: gerrit_run_init | bool - command: > - docker run --rm --net=host -u gerrit - {% for volume in gerrit_container_volumes %} - -v {{ volume }} - {% endfor %} - {{ gerrit_container_image }} - /usr/local/openjdk-8/bin/java -jar /var/gerrit/bin/gerrit.war init -d /var/gerrit -b --no-auto-start --install-all-plugins - -- name: Run docker-compose up - shell: - cmd: docker-compose up -d - chdir: /etc/gerrit-compose/ +- name: Start gerrit + include_tasks: start.yaml diff --git a/playbooks/roles/gerrit/tasks/start.yaml b/playbooks/roles/gerrit/tasks/start.yaml new file mode 100644 index 0000000000..806be27efe --- /dev/null +++ b/playbooks/roles/gerrit/tasks/start.yaml @@ -0,0 +1,17 @@ +# TODO(mordred) Make this suck less, like if we could do an init container +# or something just generally less gross. +- name: Run gerrit init + when: gerrit_run_init | bool + command: > + docker run --rm --net=host -u gerrit + {% for volume in gerrit_container_volumes %} + -v {{ volume }} + {% endfor %} + {{ gerrit_container_image }} + /usr/local/openjdk-8/bin/java -jar /var/gerrit/bin/gerrit.war init -d /var/gerrit -b --no-auto-start --install-all-plugins + +- name: Run docker-compose up + shell: + cmd: docker-compose up -d + chdir: /etc/gerrit-compose/ + when: gerrit_run_compose_up | bool diff --git a/playbooks/start-review.yaml b/playbooks/start-review.yaml new file mode 100644 index 0000000000..23141e4b68 --- /dev/null +++ b/playbooks/start-review.yaml @@ -0,0 +1,9 @@ +- hosts: review + name: "start gerrit" + tasks: + - include_role: + name: gerrit + vars: + gerrit_run_init: true + gerrit_run_compose_up: true + tasks_from: start diff --git a/playbooks/zuul/templates/group_vars/review-dev.yaml.j2 b/playbooks/zuul/templates/group_vars/review-dev.yaml.j2 index b72bb84517..4cc3d8e338 100644 --- a/playbooks/zuul/templates/group_vars/review-dev.yaml.j2 +++ b/playbooks/zuul/templates/group_vars/review-dev.yaml.j2 @@ -86,6 +86,7 @@ gerrit_dev_replication_ssh_rsa_key_contents: | -----END OPENSSH PRIVATE KEY----- gerrit_dev_replication_ssh_rsa_pubkey_contents: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDgmL6EBuMLoOyf6c56XmVKmZSzZoWaXniuJHvawj97eEs3vtBIJRNMI1lGP4BlnpGeKM10IJxMZmsUo52leytrr+9hW7e4Wjao/T3CsS6JiEdLThweEZWiTGTlULeJDqgnvC6tUoxw6zUbG50t5wtLzJW9WFdaNaysWJODVVEIfFwYe/irmso0TGfW5U76NEGCnTd03Wd9GaudMnIvOKDPeq8H4VgfC70WixNPXe6JR7Ca5w4hj/GUrEnenGFLZgOk6Gu68CuKvyIh4kmy+gJQlwTLSry9WWbYZmsp1pyJU6NdTb4829sJYydx0/bjpWZ+JrXCFN2peczeGQW4hjEd gerrit-code-review-dev-replication gerrit_database_type: h2 +gerrit_run_compose_up: true gerrit_run_init: true gerrit_dev_storyboard_token: 4020000c-d1b9-4173-ab33-2f55dbc1c718 gerrit_dev_email_private_key: xxj2lTapostsobbxvpawhjhnzufaGxchrypoddcafqarrq5h diff --git a/playbooks/zuul/templates/group_vars/review.yaml.j2 b/playbooks/zuul/templates/group_vars/review.yaml.j2 index 57591df932..afdcd151d6 100644 --- a/playbooks/zuul/templates/group_vars/review.yaml.j2 +++ b/playbooks/zuul/templates/group_vars/review.yaml.j2 @@ -86,6 +86,7 @@ gerrit_replication_ssh_rsa_key_contents: | -----END OPENSSH PRIVATE KEY----- gerrit_replication_ssh_rsa_pubkey_contents: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQhZQ0z+RVPmOzY2f56N9/PrqDeHftvnagPJyOOXnCd/9N0j+stFWNmavvb8y4dRZ+y6lOJpzPYEahwUUXZHAanz5l5as+VihWq7ldcMxSPnmkC9zr65Z8eNDcM2Bzk8gx5e4DE6OgpWkc6ke9MpwI5dmfW7o53gQZkdSc94TuLr+ZCYUKo7fScsVeE+F9dT0PLyW0zU7c23PzYnkKcrB9ihpQfSfbJj9EAtsA3aA8ZdHt78i5r7+0u0JZxaWoKjkCfYqC8ofbTU61YuUO8TTgNgMC6ZzBmTRdRRRKdGun+m1fqtgIqPSi+iZpKnERgg/hPwY+gqcKh+svW6pgCDhJ gerrit-code-review-replication gerrit_database_type: h2 +gerrit_run_compose_up: true gerrit_run_init: true gerrit_storyboard_token: 52514e74-4b8f-4d6d-a29a-a6262f97578a gerrit_email_private_key: wjpkxebohgbid6rpuwpfrYsouxpgseluqir6yupppBczoezj