diff --git a/playbooks/gitea-rename-tasks.yaml b/playbooks/gitea-rename-tasks.yaml index f6a8e4751d..9d520bbf67 100644 --- a/playbooks/gitea-rename-tasks.yaml +++ b/playbooks/gitea-rename-tasks.yaml @@ -8,6 +8,10 @@ neworg: "{{ repo.new.split('/')[0] }}" oldproj: "{{ repo.old.split('/')[1] }}" newproj: "{{ repo.new.split('/')[1] }}" +- name: "Make new gitea org" + include_tasks: roles/gitea-git-repos/tasks/setup-org.yaml + var: + org: "{{ neworg }}" - name: "Get repo {{ oldorg }}/{{ oldproj }}" uri: url: "{{ gitea_url }}/api/v1/repos/{{ oldorg }}/{{ oldproj }}" diff --git a/playbooks/rename_repos.yaml b/playbooks/rename_repos.yaml index c799f993c2..af3242fb84 100644 --- a/playbooks/rename_repos.yaml +++ b/playbooks/rename_repos.yaml @@ -9,35 +9,34 @@ shell: invoke-rc.d gerrit stop - name: Update account_project_watches in gerrit database - shell: echo 'update account_project_watches set project_name = "{{ item.new }}" where project_name = "{{ item.old }}";' | mysql reviewdb --defaults-file=/root/.gerrit_db.cfg + shell: echo 'update account_project_watches set project_name = "{{ item.new }}" where project_name = "{{ item.old }}";' | mysql --defaults-file=/root/.gerrit_db.cnf reviewdb with_items: "{{ repos }}" - name: Update changes in gerrit database - shell: echo 'update changes set dest_project_name = "{{ item.new }}", created_on = created_on where dest_project_name = "{{ item.old }}";' | mysql reviewdb --defaults-file=/root/.gerrit_db.cfg + shell: echo 'update changes set dest_project_name = "{{ item.new }}", created_on = created_on where dest_project_name = "{{ item.old }}";' | mysql --defaults-file=/root/.gerrit_db.cnf reviewdb with_items: "{{ repos }}" + - 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/', '/opt/lib/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/', '/opt/lib/git/' ] - "{{ repos }}" -- hosts: 'git0*' - gather_facts: False - tasks: - - - include_vars: "{{ repolist }}" - - - name: Rename git repos on git farm - shell: mv {{ item[0] }}{{ item[1].old }}.git {{ item[0] }}{{ item[1].new }}.git - with_nested: - - [ '/var/lib/git/' ] - - "{{ repos }}" - - hosts: gitea gather_facts: False vars: - gitea_url: http://localhost:3000 + gitea_url: https://localhost:3000 tasks: - name: Get a CSRF token uri: @@ -56,7 +55,7 @@ loop_control: loop_var: repo -- hosts: storyboard.openstack.org +- hosts: storyboard-dev gather_facts: False remote_user: root tasks: @@ -64,7 +63,20 @@ - include_vars: "{{ repolist }}" - name: Rename projects in storyboard - shell: echo 'update projects set name="{{ item.new }}" where name="{{ item.old }}";' | mysql --defaults-file=/root/.storyboard_db.cnf 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: review @@ -82,7 +94,6 @@ remote_user: root tasks: - # TODO: gerrit startup exceeds the timeout, so this task fails - name: Start gerrit shell: invoke-rc.d gerrit start