From 3e0ef28675dca085d1ad1ba3303ad04acd30960d Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Tue, 21 Nov 2017 07:54:17 +0000 Subject: [PATCH] Remove symlinked git cache functionality Prior to zuul v3 there was a cache of all git repositories on the host, and this functionality used a bind-mount and symlinks to pull the cache into the repo server as a way to cut time taken and reduce errors due to git cloning. The cache is no longer there, so the functionality which implements the symlink and bind-mount is being removed. The ability to make use of a git cache is still available for deployers to use if they want to, but the cache will be synchronised into the container instead of using bind mounts and symlinks which was the ionly method intended for production use anyway. This cuts down the complexity of the implementation. Co-Authored-By: Jean-Philippe Evrard Needed-By: I397c67a4b0166ad9f42a186f5c7137571772693a Change-Id: Id95ad2f01b52222a07cb0775026d941ab86cd9ab --- playbooks/repo-build.yml | 45 ------------------- playbooks/repo-server.yml | 14 ------ .../tasks/prepare_aio_config.yml | 10 ----- .../templates/user_variables.aio.yml.j2 | 5 --- 4 files changed, 74 deletions(-) diff --git a/playbooks/repo-build.yml b/playbooks/repo-build.yml index a6b35d2227..c1020baeba 100644 --- a/playbooks/repo-build.yml +++ b/playbooks/repo-build.yml @@ -68,49 +68,6 @@ register: _local_git_cache when: repo_build_git_cache is defined - - name: Check if deployment host has the bind mount for the master repo container - local_action: - module: stat - path: "{{ repo_build_git_bind_mount }}" - register: _local_repo_bind_mount - when: - - inventory_hostname == groups['repo_all'][0] - - _local_git_cache.stat is defined - - _local_git_cache.stat.exists - - - name: Check if the repo container bind mount is empty - local_action: command - ls -1A {{ repo_build_git_bind_mount }} - register: _local_repo_bind_mount_contents - when: - - _local_repo_bind_mount.stat is defined - - _local_repo_bind_mount.stat.exists - - not _local_repo_bind_mount.stat.islnk - - - name: Remove the bind mounted git directory so we can symlink the cache folder to replace it - local_action: - module: file - path: "{{ repo_build_git_bind_mount }}" - state: absent - register: _local_repo_bind_mount_dir_remove - when: - - _local_repo_bind_mount.stat is defined - - _local_repo_bind_mount.stat.exists - - not _local_repo_bind_mount.stat.islnk - - _local_repo_bind_mount_contents.stdout_lines | length == 0 - - - name: Symlink the git cache into the repo container bind mount - local_action: - module: file - src: "{{ repo_build_git_cache }}" - dest: "{{ repo_build_git_bind_mount }}" - state: link - when: - - _local_git_cache.stat is defined - - _local_git_cache.stat.exists - - _local_repo_bind_mount.stat is defined - - _local_repo_bind_mount.stat.exists - - name: Synchronise the contents of the git cache to the repo server synchronize: src: "{{ repo_build_git_cache }}" @@ -118,8 +75,6 @@ when: - _local_git_cache.stat is defined - _local_git_cache.stat.exists - - _local_repo_bind_mount.stat is defined - - not _local_repo_bind_mount.stat.exists roles: - role: "repo_build" diff --git a/playbooks/repo-server.yml b/playbooks/repo-server.yml index 25b0a09de2..beec74d0df 100644 --- a/playbooks/repo-server.yml +++ b/playbooks/repo-server.yml @@ -28,24 +28,10 @@ when: repo_build_git_cache is defined - include: common-tasks/os-lxc-container-setup.yml - static: no vars: list_of_bind_mounts: - mount_path: "/openstack/{{ inventory_hostname }}" bind_dir_path: "/var/www" - when: repo_build_git_cache is not defined or not _local_git_cache.stat.exists - - - include: common-tasks/os-lxc-container-setup.yml - static: no - vars: - list_of_bind_mounts: - - mount_path: "/openstack/{{ inventory_hostname }}" - bind_dir_path: "/var/www" - - mount_path: "{{ repo_build_git_cache }}" - bind_dir_path: "{{ repo_build_git_cache }}" - when: - - repo_build_git_cache is defined - - _local_git_cache.stat.exists - include: common-tasks/unbound-clients.yml static: no diff --git a/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml b/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml index ade2187de7..27033936c5 100644 --- a/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml +++ b/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml @@ -119,16 +119,6 @@ repo_build_pip_extra_indexes: "{{ fastest_wheel_mirror.stdout_lines }}" when: not pip_conf_file.stat.exists -- name: Check whether the host has a git cache - stat: - path: /opt/git/openstack - register: _local_git_cache - -- name: Set repo_build_git_cache fact - set_fact: - repo_build_git_cache: /opt/git/openstack - when: _local_git_cache.stat.exists - - name: Set the user_variables config_template: src: "{{ bootstrap_user_variables_template }}" diff --git a/tests/roles/bootstrap-host/templates/user_variables.aio.yml.j2 b/tests/roles/bootstrap-host/templates/user_variables.aio.yml.j2 index 92e449f097..b2796196c1 100644 --- a/tests/roles/bootstrap-host/templates/user_variables.aio.yml.j2 +++ b/tests/roles/bootstrap-host/templates/user_variables.aio.yml.j2 @@ -172,11 +172,6 @@ lxc_image_cache_server_mirrors: cache_timeout: {{ cache_timeout }} {% endif %} -{% if repo_build_git_cache is defined %} -## Git cache to use for the repo build process -repo_build_git_cache: {{ repo_build_git_cache }} -{% endif %} - # The container backing store is set to 'machinectl' to speed up the # AIO build time. Options are: [machinectl, overlayfs, btrfs, zfs, dir, lvm] lxc_container_backing_store: "machinectl"