system-config/playbooks/zuul/upgrade-review.yaml
Clark Boylan a2dce17612 Test Gerrit upgrade from 3.4 to 3.5
This reenables Gerrit upgrade testing but tests the 3.4 to 3.5 upgrade
now. Note this may need some work to get happy once we have 3.5 images
which is why we've split it out into a separate change.

Change-Id: Ibbbd3f98ac2df8d99d4ffda57df59f4a47da3cd3
2022-02-03 08:11:31 -08:00

53 lines
1.5 KiB
YAML

- name: Ensure initial gerrit state
import_playbook: ../service-review.yaml
vars:
gerrit_container_image: docker.io/opendevorg/gerrit:3.4
- hosts: "review:!disabled"
name: "Prepare Gerrit for Upgrade"
tasks:
- name: Pause for a few seconds to give gerrit time to start
wait_for:
timeout: 30
- name: Stop gerrit before we upgrade
shell:
cmd: docker-compose down
chdir: /etc/gerrit-compose/
- name: Backup config files
block:
- name: Find .config files
find:
paths: /home/gerrit2/review_site/etc
patterns: '*.config'
register: _config_files
- name: 'Backup config file'
copy:
src: '{{ item }}'
dest: '{{ item }}.pre-upgrade'
remote_src: true
loop: "{{ _config_files.files | map(attribute='path') | list }}"
- name: Perform gerrit upgrade
import_playbook: ../service-review.yaml
vars:
gerrit_container_image: docker.io/opendevorg/gerrit:3.5
gerrit_run_init: true
- hosts: "review:!disabled"
name: "Post upgrade config check"
tasks:
- name: Diff config files
shell: |
diff -u {{ item }}.pre-upgrade {{ item }} | tee {{ item }}.diff
loop: "{{ _config_files.files | map(attribute='path') | list }}"
register: _diff_output
- name: Check diffs
fail:
msg: 'Difference detected in file {{ item.item }} '
when: item.rc != 0
loop: '{{ _diff_output.results }}'