Merge "Check for new Gerrit on disk caches when upgrading Gerrit"

This commit is contained in:
Zuul 2022-07-25 16:49:06 +00:00 committed by Gerrit Code Review
commit 2afc0ea097

View File

@ -34,6 +34,8 @@
cmd: docker-compose down cmd: docker-compose down
chdir: /etc/gerrit-compose/ chdir: /etc/gerrit-compose/
# This allows us to check that our config file isn't modified by newer
# Gerrit versions.
- name: Backup config files - name: Backup config files
block: block:
- name: Find .config files - name: Find .config files
@ -49,6 +51,14 @@
remote_src: true remote_src: true
loop: "{{ _config_files.files | map(attribute='path') | list }}" loop: "{{ _config_files.files | map(attribute='path') | list }}"
# Record h2 cache files. We will use this to highlight any new caches
# under the new Gerrit version.
- name: Record Gerrit old cache files
find:
paths: /home/gerrit2/review_site/cache
patterns: '*.h2.db'
register: _old_cache_files
- name: Perform gerrit upgrade - name: Perform gerrit upgrade
import_playbook: ../service-review.yaml import_playbook: ../service-review.yaml
vars: vars:
@ -64,8 +74,28 @@
loop: "{{ _config_files.files | map(attribute='path') | list }}" loop: "{{ _config_files.files | map(attribute='path') | list }}"
register: _diff_output register: _diff_output
- name: Check diffs - name: Check config diffs
fail: fail:
msg: 'Difference detected in file {{ item.item }} ' msg: 'Difference detected in file {{ item.item }} '
when: item.rc != 0 when: item.rc != 0
loop: '{{ _diff_output.results }}' loop: '{{ _diff_output.results }}'
- name: Record Gerrit new cache files
find:
paths: /home/gerrit2/review_site/cache
patterns: '*.h2.db'
register: _new_cache_files
- name: Manipulate find data for caches
set_fact:
_old_cache_paths: "{{ _old_cache_files.files | map(attribute='path') | list }}"
_new_cache_paths: "{{ _new_cache_files.files | map(attribute='path') | list }}"
- name: Find delta between cache listings
set_fact:
_gerrit_cache_difference: "{{ _old_cache_paths | symmetric_difference(_new_cache_paths) }}"
- name: Check for new cache files
debug:
msg: "The new Gerrit version produces new on disk caches: {{ _gerrit_cache_difference }}"
when: _gerrit_cache_difference | length > 0