From 5d790863502dea7791d62e52a907a0497e327234 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Wed, 25 Mar 2020 10:25:55 -0500 Subject: [PATCH] Run manage-projects on gerrit servers We have a wrapper script now that works on the gerrit servers. Run it after we run the gitea repo creation. Remove the -it since this is not an interactive run. Add net=host so that localhost maps. And set the server to localhost. Don't run manage-projects in gate jobs for run-review yet, because we don't have a functioning enough gerrit. We can follow up with that. Change-Id: I8c0eb5d7973815ae21d4d5bc1be8d4bdfe56d7fc --- .zuul.yaml | 2 -- playbooks/manage-projects.yaml | 5 +++++ playbooks/roles/gerrit/templates/manage-projects.j2 | 2 +- playbooks/roles/gerrit/templates/projects.ini.j2 | 2 +- playbooks/roles/gerrit/templates/track-upstream.j2 | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index b0b67150f2..6d41213da2 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1111,7 +1111,6 @@ - playbooks/service-letsencrypt.yaml - playbooks/service-review-dev.yaml - playbooks/service-review.yaml - - playbooks/manage-projects.yaml host-vars: review-dev01.opendev.org: host_copy_output: @@ -1130,7 +1129,6 @@ - playbooks/service-letsencrypt.yaml - ^playbooks/service-review.*.yaml - playbooks/group_vars/review.yaml - - playbooks/manage-projects.yaml - ^playbooks/host_vars/review\d+.openstack.org.yaml - playbooks/group_vars/review-dev.yaml - ^playbooks/host_vars/review-dev\d+.opendev.org.yaml diff --git a/playbooks/manage-projects.yaml b/playbooks/manage-projects.yaml index 70519819bd..5617055ffd 100644 --- a/playbooks/manage-projects.yaml +++ b/playbooks/manage-projects.yaml @@ -16,3 +16,8 @@ roles: - gitea-git-repos +- hosts: "review:review-dev:!disabled" + name: "Create repos on gerrit servers" + tasks: + - name: Run manage-projects + command: /usr/local/bin/manage-projects diff --git a/playbooks/roles/gerrit/templates/manage-projects.j2 b/playbooks/roles/gerrit/templates/manage-projects.j2 index 7a8a027888..aa68f41c75 100644 --- a/playbooks/roles/gerrit/templates/manage-projects.j2 +++ b/playbooks/roles/gerrit/templates/manage-projects.j2 @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -exec docker run -it --rm -u root \ +exec docker run --rm --net=host -u root \ -v{{ gerrit_project_config_base }}:/opt/project-config \ -v{{ gerrit_project_config_base }}/gerrit/projects.yaml:/home/gerrit2/projects.yaml \ -v/opt/lib/git:/opt/lib/git \ diff --git a/playbooks/roles/gerrit/templates/projects.ini.j2 b/playbooks/roles/gerrit/templates/projects.ini.j2 index 20b0d505d6..f2b36a917a 100644 --- a/playbooks/roles/gerrit/templates/projects.ini.j2 +++ b/playbooks/roles/gerrit/templates/projects.ini.j2 @@ -3,7 +3,7 @@ homepage=https://opendev.org acl-dir=/opt/project-config/gerrit/acls local-git-dir=/opt/lib/git jeepyb-cache-dir=/opt/lib/jeepyb -gerrit-host={{ gerrit_vhost_name }} +gerrit-host=localhost gerrit-user={{ gerrit_project_creator_user }} gerrit-committer=OpenDev Project Creator gerrit-key=/home/gerrit2/review_site/etc/ssh_project_rsa_key diff --git a/playbooks/roles/gerrit/templates/track-upstream.j2 b/playbooks/roles/gerrit/templates/track-upstream.j2 index c37eade95a..117035f5ab 100644 --- a/playbooks/roles/gerrit/templates/track-upstream.j2 +++ b/playbooks/roles/gerrit/templates/track-upstream.j2 @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -exec docker run -it --rm -u root \ +exec docker run --rm --net=host -u root \ -v{{ gerrit_project_config_base }}:/opt/project-config \ -v{{ gerrit_project_config_base }}/gerrit/projects.yaml:/home/gerrit2/projects.yaml \ -v/opt/lib/git:/opt/lib/git \