diff --git a/.zuul.yaml b/.zuul.yaml index 954ba14c7e..2049a9e392 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1031,7 +1031,7 @@ - testinfra/test_zuul_preview.py - job: - name: system-config-run-review-dev + name: system-config-run-review parent: system-config-run description: | Run the playbook for gerrit (in a container). @@ -1061,6 +1061,7 @@ - ^playbooks/host_vars/review\d+.opendev.org.yaml - playbooks/group_vars/review-dev.yaml - ^playbooks/host_vars/review-dev\d+.opendev.org.yaml + - ^playbooks/service-review.*.yaml - playbooks/zuul/templates/group_vars/review-dev.yaml.j2 - playbooks/zuul/templates/group_vars/review.yaml.j2 - playbooks/roles/gerrit/ @@ -1123,7 +1124,7 @@ soft: true - name: system-config-build-image-haproxy-statsd soft: true - - system-config-run-review-dev + - system-config-run-review - system-config-run-zuul-preview - system-config-run-letsencrypt - system-config-build-image-bazel @@ -1192,7 +1193,7 @@ soft: true - name: system-config-upload-image-haproxy-statsd soft: true - - system-config-run-review-dev + - system-config-run-review - system-config-run-zuul-preview - system-config-run-letsencrypt - system-config-upload-image-bazel diff --git a/playbooks/roles/gerrit/defaults/main.yaml b/playbooks/roles/gerrit/defaults/main.yaml index 2136969cf7..0560ca6f00 100644 --- a/playbooks/roles/gerrit/defaults/main.yaml +++ b/playbooks/roles/gerrit/defaults/main.yaml @@ -3,3 +3,14 @@ gerrit_user_name: gerrit2 gerrit_home_dir: /home/gerrit2 gerrit_site_dir: "{{ gerrit_home_dir }}/review_site" gerrit_run_init: false +gerrit_container_image: docker.io/opendevorg/gerrit:2.13 +gerrit_container_volumes: + - /home/gerrit2/review_site/cache:/var/gerrit/cache + - /home/gerrit2/review_site/etc:/var/gerrit/etc + - /home/gerrit2/review_site/git:/var/gerrit/git + - /home/gerrit2/review_site/tmp:/var/gerrit/tmp + - /home/gerrit2/review_site/hooks:/var/gerrit/hooks + - /home/gerrit2/review_site/index:/var/gerrit/index + - /home/gerrit2/review_site/logs:/var/log/gerrit + - /home/gerrit2/review_site/static:/var/gerrit/static + - /home/gerrit2/.launchpadlib:/var/gerrit/.launchpadlib diff --git a/playbooks/roles/gerrit/files/gerrit-podman/docker-compose.yaml b/playbooks/roles/gerrit/files/gerrit-podman/docker-compose.yaml deleted file mode 100644 index 8faf28bea5..0000000000 --- a/playbooks/roles/gerrit/files/gerrit-podman/docker-compose.yaml +++ /dev/null @@ -1,17 +0,0 @@ -version: '3' - -services: - gerrit: - image: docker.io/opendevorg/gerrit:2.13 - network_mode: host - user: gerrit - volumes: - - /home/gerrit2/review_site/cache:/var/gerrit/cache - - /home/gerrit2/review_site/etc:/var/gerrit/etc - - /home/gerrit2/review_site/git:/var/gerrit/git - - /home/gerrit2/review_site/tmp:/var/gerrit/tmp - - /home/gerrit2/review_site/hooks:/var/gerrit/hooks - - /home/gerrit2/review_site/index:/var/gerrit/index - - /home/gerrit2/review_site/logs:/var/log/gerrit - - /home/gerrit2/review_site/static:/var/gerrit/static - - /home/gerrit2/.launchpadlib:/var/gerrit/.launchpadlib diff --git a/playbooks/roles/gerrit/tasks/main.yaml b/playbooks/roles/gerrit/tasks/main.yaml index 45893076c3..836aaeb876 100644 --- a/playbooks/roles/gerrit/tasks/main.yaml +++ b/playbooks/roles/gerrit/tasks/main.yaml @@ -9,10 +9,22 @@ dest: /opt/project-config force: yes -- name: Synchronize podman-compose directory - synchronize: - src: gerrit-podman/ - dest: /etc/gerrit-podman/ +- name: Ensure /etc/gerrit-compose directory + file: + state: directory + path: /etc/gerrit-compose + mode: 0755 + +- name: Put docker-compose file in place + template: + src: docker-compose.yaml.j2 + dest: /etc/gerrit-compose/docker-compose.yaml + mode: 0644 + +- name: Clean up old directory + file: + state: absent + path: /etc/gerrit-podman - name: Create Gerrit Group group: @@ -180,18 +192,13 @@ when: gerrit_run_init | bool command: > podman run -it --rm --net=host -u gerrit - -v /home/gerrit2/review_site/cache:/var/gerrit/cache - -v /home/gerrit2/review_site/etc:/var/gerrit/etc - -v /home/gerrit2/review_site/git:/var/gerrit/git - -v /home/gerrit2/review_site/tmp:/var/gerrit/tmp - -v /home/gerrit2/review_site/hooks:/var/gerrit/hooks - -v /home/gerrit2/review_site/index:/var/gerrit/index - -v /home/gerrit2/review_site/logs:/var/log/gerrit - -v /home/gerrit2/review_site/static:/var/gerrit/static - docker.io/opendevorg/gerrit:2.13 + {% 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 podman-compose up shell: cmd: podman-compose up -d - chdir: /etc/gerrit-podman/ + chdir: /etc/gerrit-compose/ diff --git a/playbooks/roles/gerrit/templates/docker-compose.yaml.j2 b/playbooks/roles/gerrit/templates/docker-compose.yaml.j2 new file mode 100644 index 0000000000..2f3e32acea --- /dev/null +++ b/playbooks/roles/gerrit/templates/docker-compose.yaml.j2 @@ -0,0 +1,11 @@ +version: '3' + +services: + gerrit: + image: {{ gerrit_container_image }} + network_mode: host + user: gerrit + volumes: +{% for volume in gerrit_container_volumes %} + - {{ volume }} +{% endfor %}