e0daa683ac
We will be doing our first set of project renames in about a month since we've noticed that the waiting queue is not draining properly. The contents of this queue produce many scary looking (on the order of thousands) exceptions during gerrit startup. Move the queue aside to avoid confusion and uncertainty of problems during the project rename process. Change-Id: I3cd8fd17de340d536dd7e4e07fa1e18c86107832
168 lines
4.9 KiB
YAML
168 lines
4.9 KiB
YAML
- hosts: review
|
|
gather_facts: False
|
|
remote_user: root
|
|
tasks:
|
|
|
|
- include_vars: "{{ repolist }}"
|
|
|
|
- name: Stop Gerrit
|
|
shell:
|
|
cmd: docker-compose down
|
|
chdir: /etc/gerrit-compose/
|
|
|
|
- name: Make organization dir
|
|
file:
|
|
state: directory
|
|
path: "{{ (item[0] + item[1].new) | dirname }}"
|
|
group: gerrit2
|
|
owner: gerrit2
|
|
mode: 0755
|
|
with_nested:
|
|
- [ '~gerrit2/review_site/git/' ]
|
|
- "{{ repos }}"
|
|
|
|
- name: Rename git repos on gerrit
|
|
shell: mv {{ item[0] }}{{ item[1].old }}.git {{ item[0] }}{{ item[1].new }}.git
|
|
with_nested:
|
|
- [ '~gerrit2/review_site/git/' ]
|
|
- "{{ repos }}"
|
|
|
|
- hosts: gitea
|
|
gather_facts: False
|
|
vars:
|
|
gitea_url: https://localhost:3000
|
|
tasks:
|
|
- include_vars: "{{ repolist }}"
|
|
- name: Move gitea repo
|
|
include_tasks: gitea-rename-tasks.yaml
|
|
loop: "{{ repos }}"
|
|
loop_control:
|
|
loop_var: repo
|
|
|
|
- hosts: storyboard-dev
|
|
gather_facts: False
|
|
remote_user: root
|
|
tasks:
|
|
|
|
- include_vars: "{{ repolist }}"
|
|
|
|
- name: Rename projects in storyboard
|
|
shell: echo 'update projects set name="{{ item.new }}" where name="{{ item.old }}";' | mysql --defaults-file=/etc/mysql/debian.cnf storyboard
|
|
with_items: "{{ repos }}"
|
|
# We don't want to be blocked by errors on the dev server.
|
|
ignore_errors: yes
|
|
|
|
- hosts: storyboard
|
|
gather_facts: False
|
|
remote_user: root
|
|
tasks:
|
|
|
|
- include_vars: "{{ repolist }}"
|
|
|
|
- name: Rename projects in storyboard
|
|
shell: echo 'update projects set name="{{ item.new }}" where name="{{ item.old }}";' | mysql --defaults-file=/etc/mysql/debian.cnf storyboard
|
|
with_items: "{{ repos }}"
|
|
|
|
- hosts: zuul02.opendev.org
|
|
gather_facts: False
|
|
remote_user: root
|
|
tasks:
|
|
- include_vars: "{{ repolist }}"
|
|
|
|
- name: Backup the zuul keys before we modify them
|
|
command: "docker exec zuul-scheduler_scheduler_1 zuul-admin export-keys /var/lib/zuul/zuul-keys-backup.json"
|
|
|
|
- name: Copy zuul keys from old to new project
|
|
command: "docker exec zuul-scheduler_scheduler_1 zuul-admin copy-keys gerrit {{ item.old }} gerrit {{ item.new }}"
|
|
loop: "{{ repos }}"
|
|
|
|
- hosts: review
|
|
gather_facts: False
|
|
remote_user: root
|
|
become: yes
|
|
become_user: gerrit2
|
|
tasks:
|
|
|
|
- name: Make backup of gerrit index
|
|
shell: cp -ax /home/gerrit2/review_site/index /home/gerrit2/index.backup.$(date +%s)
|
|
|
|
# As an alternative we can simply delete the waiting queue. Previously
|
|
# these were copied for debugging purposes but the problems are
|
|
# reasonably well understood so we probably don't need to keep collecting
|
|
# more data.
|
|
# We use the tmp/ path because it is not backed up and we don't need to
|
|
# preserve this information long term.
|
|
- name: Create replication queue target location
|
|
file:
|
|
path: /home/gerrit2/tmp/replication_waiting_queues
|
|
state: directory
|
|
mode: '0755'
|
|
owner: gerrit2
|
|
group: gerrit2
|
|
- name: Move the replication plugin waiting queue aside due to bugs
|
|
shell: mv /home/gerrit2/review_site/data/replication/ref-updates/waiting /home/gerrit2/tmp/replication_waiting_queues/waiting_queue_$(date +%s)
|
|
|
|
- hosts: review
|
|
gather_facts: False
|
|
remote_user: root
|
|
tasks:
|
|
|
|
- name: Start gerrit
|
|
include_role:
|
|
name: gerrit
|
|
tasks_from: start
|
|
vars:
|
|
gerrit_run_init: false
|
|
gerrit_run_reindex: false
|
|
gerrit_run_compose_up: true
|
|
|
|
- hosts: review
|
|
gather_facts: False
|
|
remote_user: root
|
|
become: yes
|
|
become_user: gerrit2
|
|
tasks:
|
|
|
|
- include_vars: "{{ repolist }}"
|
|
|
|
- name: Wait for gerrit ssh to be listening
|
|
wait_for:
|
|
host: localhost
|
|
port: 29418
|
|
# Far longer than necessary
|
|
timeout: 1800
|
|
|
|
- name: Sleep a bit longer just to be sure it is up
|
|
wait_for:
|
|
timeout: 30
|
|
|
|
- name: Set base ssh command fact
|
|
set_fact:
|
|
gerrit_ssh_command: ssh -p 29418 -i /home/gerrit2/review_site/etc/ssh_project_rsa_key openstack-project-creator@localhost gerrit
|
|
|
|
- name: Rename groups in gerrit
|
|
shell: "{{ gerrit_ssh_command }} rename-group {{ item.old }} {{ item.new }}"
|
|
with_items: "{{ gerrit_groups|default([]) }}"
|
|
|
|
- name: Start online reindex of accounts
|
|
shell: "{{ gerrit_ssh_command }} index start accounts --force"
|
|
|
|
- name: Start online reindex of groups
|
|
shell: "{{ gerrit_ssh_command }} index start groups --force"
|
|
|
|
- name: Start online reindex of projects
|
|
shell: "{{ gerrit_ssh_command }} index start projects --force"
|
|
|
|
- name: Start online reindex of changes
|
|
shell: "{{ gerrit_ssh_command }} index start changes --force"
|
|
|
|
- hosts: zuul02.opendev.org
|
|
gather_facts: False
|
|
remote_user: root
|
|
tasks:
|
|
- include_vars: "{{ repolist }}"
|
|
|
|
- name: Remove old zuul project keys
|
|
command: "docker exec zuul-scheduler_scheduler_1 zuul-admin delete-keys gerrit {{ item.old }}"
|
|
loop: "{{ repos }}"
|