d40f5d3089
This adds upgrade testing from our current Gerrit version (3.5) to the likely future version of our next upgrade (3.6). To do so we have to refactor the gerrit testing becase the 3.5 to 3.6 upgrade requires we run a command against 3.5. The previous upgrade system assumed the old version could be left alone and jumped straight into the upgrade finally testing the end state. Now we have split up the gerrit bootstrapping and gerrit testing so that normal gerrit testing and upgrade testing can run these different tasks at different points in the gerrit deployment process. Now the upgrade tests use the bootstrapping playbook to create users, projects, and changes on the old version of gerrit before running the copy-approvals command. Then after the upgrade we run the test assertion portion of the job. Change-Id: Id58b27e6f717f794a8ef7a048eec7fbb3bc52af6
72 lines
2.2 KiB
YAML
72 lines
2.2 KiB
YAML
# 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/
|
|
|
|
- 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.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 diffs
|
|
fail:
|
|
msg: 'Difference detected in file {{ item.item }} '
|
|
when: item.rc != 0
|
|
loop: '{{ _diff_output.results }}'
|