Merge "Update project rename instructions"
This commit is contained in:
commit
5039ba4ebb
@ -415,49 +415,6 @@ project in question, and about 10 minutes of downtime for all of
|
|||||||
Gerrit. All Gerrit changes, merged and open, will carry over, so
|
Gerrit. All Gerrit changes, merged and open, will carry over, so
|
||||||
in-progress changes do not need to be merged before the move.
|
in-progress changes do not need to be merged before the move.
|
||||||
|
|
||||||
Note that some of the steps in the process below are repetitive and
|
|
||||||
so for larger batches a script can be used to generate the command
|
|
||||||
lists for upload to and execution on their respective servers::
|
|
||||||
|
|
||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# Expects a renames.list file in the current directory with:
|
|
||||||
#
|
|
||||||
# stackforge/foo -> openstack/foo
|
|
||||||
# openstack/oldbar -> openstack/newbar
|
|
||||||
|
|
||||||
echo "\nGerrit database updates\n-----------------------"
|
|
||||||
for r in `sed 's/ -> /@/' renames.list` ; do
|
|
||||||
OLD=`echo $r | cut -d@ -f1`
|
|
||||||
NEW=`echo $r | cut -d@ -f2`
|
|
||||||
echo "update account_project_watches set project_name = \"$NEW\" where
|
|
||||||
project_name = \"$OLD\";"
|
|
||||||
echo "update changes set dest_project_name = \"$NEW\",
|
|
||||||
created_on = created_on where dest_project_name = \"$OLD\";"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "\nGerrit filesystem updates\n-------------------------"
|
|
||||||
for r in `sed 's/ -> /@/' renames.list` ; do
|
|
||||||
OLD=`echo $r | cut -d@ -f1` ; NEW=`echo $r | cut -d@ -f2`
|
|
||||||
echo "sudo mv ~gerrit2/review_site/git/{$OLD,$NEW}.git"
|
|
||||||
echo "sudo mv /opt/lib/git/{$OLD,$NEW}.git"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "\nGit farm filesystem updates\n---------------------------"
|
|
||||||
for r in `sed 's/ -> /@/' renames.list` ; do
|
|
||||||
OLD=`echo $r | cut -d@ -f1`
|
|
||||||
NEW=`echo $r | cut -d@ -f2`
|
|
||||||
echo "sudo mv /var/lib/git/{$OLD,$NEW}.git"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "\nJenkins workspace cleanup\n-------------------------"
|
|
||||||
for r in `sed 's/ -> /@/' renames.list` ; do
|
|
||||||
NAME=`echo $r | cut -d@ -f1 | cut -d/ -f2`
|
|
||||||
echo "sudo ansible-playbook -f 10 \\
|
|
||||||
/etc/ansible/playbooks/clean_workspaces.yaml \\
|
|
||||||
--extra-vars \"project=$NAME\""
|
|
||||||
done
|
|
||||||
|
|
||||||
To rename a project:
|
To rename a project:
|
||||||
|
|
||||||
#. Prepare a change to the project-config repo to update things like
|
#. Prepare a change to the project-config repo to update things like
|
||||||
@ -468,15 +425,6 @@ To rename a project:
|
|||||||
openstack/governance repo, and .gitmodules in the
|
openstack/governance repo, and .gitmodules in the
|
||||||
openstack/openstack repo if necessary.
|
openstack/openstack repo if necessary.
|
||||||
|
|
||||||
#. Stop puppet runs on the puppetmaster to prevent early application
|
|
||||||
of configuration changes::
|
|
||||||
|
|
||||||
sudo crontab -u root -e
|
|
||||||
|
|
||||||
Comment out the crontab entries. Use ps to make sure that a run is
|
|
||||||
not currently in progress. When it finishes, make sure the entry
|
|
||||||
has not been added back to the crontab.
|
|
||||||
|
|
||||||
#. Prepare a yaml file called repos.yaml that has a single dictionary called
|
#. Prepare a yaml file called repos.yaml that has a single dictionary called
|
||||||
`repos` with a list of dictionaries each having an old and new entry.
|
`repos` with a list of dictionaries each having an old and new entry.
|
||||||
Optionally also add a `gerrit_groups` dict of the same form::
|
Optionally also add a `gerrit_groups` dict of the same form::
|
||||||
@ -488,13 +436,37 @@ To rename a project:
|
|||||||
- old: old-core-group
|
- old: old-core-group
|
||||||
new: new-core-group
|
new: new-core-group
|
||||||
|
|
||||||
|
#. An hour in advance of the maintenance (if possible), stop puppet
|
||||||
|
runs on the puppetmaster to prevent early application of
|
||||||
|
configuration changes::
|
||||||
|
|
||||||
|
sudo crontab -u root -e
|
||||||
|
|
||||||
|
Comment out the crontab entries. Use ps to make sure that a run is
|
||||||
|
not currently in progress. When it finishes, make sure the entry
|
||||||
|
has not been added back to the crontab.
|
||||||
|
|
||||||
|
#. Export and stop Zuul on zuul.openstack.org::
|
||||||
|
|
||||||
|
python /opt/zuul/tools/zuul-changes.py http://zuul.openstack.org gate >gate.sh
|
||||||
|
python /opt/zuul/tools/zuul-changes.py http://zuul.openstack.org check >check.sh
|
||||||
|
sudo invoke-rc.d zuul stop
|
||||||
|
sudo rm -f /var/run/zuul/zuul.pid /var/run/zuul/zuul.listedock
|
||||||
|
|
||||||
#. Run the ansible rename repos playbook, passing in the path to your yaml
|
#. Run the ansible rename repos playbook, passing in the path to your yaml
|
||||||
file::
|
file::
|
||||||
|
|
||||||
sudo ansible-playbook -f 10 /opt/system-config/production/playbooks/rename_repos.yaml -e repolist=ABSOLUTE_PATH_TO_VARS_FILE
|
sudo ansible-playbook -f 10 /opt/system-config/production/playbooks/rename_repos.yaml -e repolist=ABSOLUTE_PATH_TO_VARS_FILE
|
||||||
|
|
||||||
#. Merge the prepared Puppet configuration change, removing the
|
#. Start Zuul on zuul.openstack.org::
|
||||||
original Jenkins jobs via the Jenkins WebUI later if needed.
|
|
||||||
|
sudo invoke-rc.d zuul start
|
||||||
|
sudo bash gate.sh
|
||||||
|
sudo bash check.sh
|
||||||
|
|
||||||
|
#. Merge the prepared Puppet configuration changes.
|
||||||
|
|
||||||
|
#. Rename the project or transfer ownership in GitHub
|
||||||
|
|
||||||
#. Re-enable puppet runs on the puppetmaster::
|
#. Re-enable puppet runs on the puppetmaster::
|
||||||
|
|
||||||
|
@ -1,74 +1,61 @@
|
|||||||
---
|
---
|
||||||
- hosts: zuul.openstack.org
|
|
||||||
gather_facts: False
|
|
||||||
remote_user: root
|
|
||||||
sudo: yes
|
|
||||||
tasks:
|
|
||||||
- shell: kill -USR1 $(cat /var/run/zuul/zuul.pid)
|
|
||||||
- shell: rm -f /var/run/zuul/zuul.pid /var/run/zuul/zuul.lock
|
|
||||||
- hosts: review.openstack.org
|
- hosts: review.openstack.org
|
||||||
gather_facts: False
|
gather_facts: False
|
||||||
remote_user: root
|
remote_user: root
|
||||||
sudo: yes
|
|
||||||
tasks:
|
tasks:
|
||||||
- shell: invoke-rc.d gerrit stop
|
- shell: invoke-rc.d gerrit stop
|
||||||
- include_vars: "{{ repolist }}"
|
- include_vars: "{{ repolist }}"
|
||||||
- shell: echo 'update account_project_watches set project_name = "{{ item.new }}" where project_name = "{{ item.old }}";' | mysql reviewdb
|
- shell: echo 'update account_project_watches set project_name = "{{ item.new }}" where project_name = "{{ item.old }}";' | mysql reviewdb
|
||||||
with_items: repos
|
with_items: {{ repos }}
|
||||||
- shell: echo 'update changes set dest_project_name = "{{ item.new }}", created_on = created_on where dest_project_name = "{{ item.old }}";' | mysql reviewdb
|
- shell: echo 'update changes set dest_project_name = "{{ item.new }}", created_on = created_on where dest_project_name = "{{ item.old }}";' | mysql reviewdb
|
||||||
with_items: repos
|
with_items: {{ repos }}
|
||||||
- shell: mv {{ item[0] }}{{ item[1].old }} {{ item[0] }}{{ item[1].new }}
|
- shell: mv {{ item[0] }}{{ item[1].old }}.git {{ item[0] }}{{ item[1].new }}.git
|
||||||
with_nested:
|
with_nested:
|
||||||
- [ '~gerrit2/review_site/git/', '/opt/lib/git' ]
|
- [ '~gerrit2/review_site/git/', '/opt/lib/git/' ]
|
||||||
- repos
|
- {{ repos }}
|
||||||
- hosts: 'git0*'
|
- hosts: 'git0*'
|
||||||
gather_facts: False
|
gather_facts: False
|
||||||
tasks:
|
tasks:
|
||||||
- include_vars: "{{ repolist }}"
|
- include_vars: "{{ repolist }}"
|
||||||
- shell: mv {{ item[0] }}{{ item[1].old }} {{ item[0] }}{{ item[1].new }}
|
- shell: mv {{ item[0] }}{{ item[1].old }}.git {{ item[0] }}{{ item[1].new }}.git
|
||||||
with_nested:
|
with_nested:
|
||||||
- [ '/var/lib/git' ]
|
- [ '/var/lib/git/' ]
|
||||||
- repos
|
- {{ repos }}
|
||||||
- hosts: storyboard.openstack.org
|
- hosts: storyboard.openstack.org
|
||||||
gather_facts: False
|
gather_facts: False
|
||||||
remote_user: root
|
remote_user: root
|
||||||
sudo: yes
|
|
||||||
tasks:
|
tasks:
|
||||||
- include_vars: "{{ repolist }}"
|
- include_vars: "{{ repolist }}"
|
||||||
- shell: echo 'update projects set name="{{ item.new }}" where name="{{ item.old }}";' | mysql storyboard
|
- shell: echo 'update projects set name="{{ item.new }}" where name="{{ item.old }}";' | mysql --defaults-file=/root/.storyboard_db.cnf storyboard
|
||||||
with_items: repos
|
with_items: {{ repos }}
|
||||||
- hosts: review.openstack.org
|
- hosts: review.openstack.org
|
||||||
gather_facts: False
|
gather_facts: False
|
||||||
remote_user: gerrit2
|
remote_user: root
|
||||||
sudo: yes
|
become: yes
|
||||||
|
become_user: gerrit2
|
||||||
tasks:
|
tasks:
|
||||||
- shell: cp -ax /home/gerrit2/review_site/index /home/gerrit2/index.backup.$(date +%s)
|
- shell: cp -ax /home/gerrit2/review_site/index /home/gerrit2/index.backup.$(date +%s)
|
||||||
- shell: java -jar /home/gerrit2/review_site/bin/gerrit.war reindex -d /home/gerrit2/review_site
|
|
||||||
- hosts: review.openstack.org
|
- hosts: review.openstack.org
|
||||||
gather_facts: False
|
gather_facts: False
|
||||||
remote_user: root
|
remote_user: root
|
||||||
sudo: yes
|
|
||||||
tasks:
|
tasks:
|
||||||
- shell: invoke-rc.d gerrit start
|
- shell: invoke-rc.d gerrit start
|
||||||
- hosts: zuul.openstack.org
|
|
||||||
gather_facts: False
|
|
||||||
remote_user: root
|
|
||||||
sudo: yes
|
|
||||||
tasks:
|
|
||||||
- shell: invoke-rc.d zuul start
|
|
||||||
- hosts: review.openstack.org
|
- hosts: review.openstack.org
|
||||||
gather_facts: False
|
gather_facts: False
|
||||||
remote_user: gerrit2
|
|
||||||
sudo: yes
|
|
||||||
tasks:
|
|
||||||
- include_vars: "{{ repolist }}"
|
|
||||||
- shell: ssh -p 29418 review.openstack.org gerrit rename-group {{ item.old }} {{ item.new }}
|
|
||||||
with_items: "{{ gerrit_groups|default([]) }}"
|
|
||||||
- hosts: '*.slave.openstack.org'
|
|
||||||
remote_user: root
|
remote_user: root
|
||||||
sudo: yes
|
become: yes
|
||||||
|
become_user: gerrit2
|
||||||
|
tasks:
|
||||||
|
- pause: prompt="Make sure that Gerrit ssh api is accepting requests. Use Enter or ^C c to continue. ^C a to abort."
|
||||||
|
- include_vars: "{{ repolist }}"
|
||||||
|
- shell: ssh -p 29418 -i /home/gerrit2/review_site/etc/ssh_project_rsa_key openstack-project-creator@review.openstack.org gerrit rename-group {{ item.old }} {{ item.new }}
|
||||||
|
with_items: "{{ gerrit_groups|default([]) }}"
|
||||||
|
# TODO: online reindex accounts
|
||||||
|
# TODO: online reindex projects
|
||||||
|
- hosts: '*.ci.openstack.org:*.slave.openstack.org'
|
||||||
|
remote_user: root
|
||||||
gather_facts: False
|
gather_facts: False
|
||||||
tasks:
|
tasks:
|
||||||
- include_vars: "{{ repolist }}"
|
- include_vars: "{{ repolist }}"
|
||||||
- shell: 'rm -rf ~jenkins/workspace/*{{ item.old | basename }}*'
|
- shell: 'rm -rf ~jenkins/workspace/*{{ item.old | basename }}*'
|
||||||
with_items: repos
|
with_items: {{ repos }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user