You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
3.3 KiB
102 lines
3.3 KiB
# Note this playbook is in the zuul/ dir because it is very test specific
|
|
# currently. We could potentially rewrite things so that this can be used
|
|
# in production but it isn't currently ready for that.
|
|
#
|
|
# In particular it bootstraps users and test changes assuming a test env.
|
|
|
|
- name: Ensure initial gerrit state
|
|
import_playbook: ../service-review.yaml
|
|
vars:
|
|
gerrit_container_image: docker.io/opendevorg/gerrit:3.5
|
|
|
|
- hosts: "review:!disabled"
|
|
name: "Wait for gerrit to be up and running"
|
|
tasks:
|
|
- name: Pause for a few seconds to give gerrit time to start
|
|
wait_for:
|
|
timeout: 30
|
|
|
|
- name: Bootstrap gerrit to be semi useable
|
|
# This is necessary to perform actions on the old side pre upgrade
|
|
import_playbook: ./bootstrap-test-review.yaml
|
|
|
|
- hosts: "review:!disabled"
|
|
name: "Prepare Gerrit for Upgrade"
|
|
tasks:
|
|
- name: Run gerrit sticky approvals migration command
|
|
shell:
|
|
cmd: |
|
|
ssh -i /root/.ssh/id_25519 -p 29418 admin@localhost \
|
|
gerrit copy-approvals -v
|
|
|
|
- name: Stop gerrit before we upgrade
|
|
shell:
|
|
cmd: docker-compose down
|
|
chdir: /etc/gerrit-compose/
|
|
|
|
# This allows us to check that our config file isn't modified by newer
|
|
# Gerrit versions.
|
|
- 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 }}"
|
|
|
|
# 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
|
|
import_playbook: ../service-review.yaml
|
|
vars:
|
|
gerrit_container_image: docker.io/opendevorg/gerrit:3.6
|
|
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 config diffs
|
|
fail:
|
|
msg: 'Difference detected in file {{ item.item }} '
|
|
when: item.rc != 0
|
|
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
|