Change build path from tmp to opt and disable COW

Building in tmp, while functional, has a couple drawbacks due to it
being tmpfs and commonly noexec. This change moves the build path to
/opt which is a regular filesystem and a common build target. This
change also removes the copy-on-write bit on the build directory
which will assist when the underlying filesystems are BTRFS or ZFS.

Change-Id: I7184765a5902f535fe18162949dd40dd0d339062
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2018-06-06 11:38:38 -05:00 committed by Kevin Carter (cloudnull)
parent d20a9614e9
commit 51fb5bb898
2 changed files with 10 additions and 8 deletions

View File

@ -44,8 +44,8 @@ repo_build_release_tag: "untagged"
repo_build_global_links_path: "{{ repo_build_base_path }}/links"
repo_build_release_version_path: "os-releases/{{ repo_build_release_tag }}"
repo_build_release_path: "{{ repo_build_base_path }}/{{ repo_build_release_version_path }}/{{ repo_build_os_distro_version }}"
repo_build_dir: "/tmp/openstack-builder"
repo_build_output: "/tmp/openstack-wheel-output"
repo_build_dir: "/opt/openstack-builder"
repo_build_output: "/opt/openstack-wheel-output"
repo_build_git_dir: "{{ repo_build_base_path }}/openstackgit"
repo_build_pool_dir: "{{ repo_build_base_path }}/pools/{{ repo_build_os_distro_version }}"
@ -88,7 +88,7 @@ repo_build_pip_default_index: "https://pypi.python.org/simple"
repo_build_timeout: 120
repo_build_concurrency: "{{ (((ansible_processor_vcpus|default(1)) | int) > 4) | ternary(8, 4) }}"
repo_build_venv_build_dir: "/tmp/openstack-venv-builder"
repo_build_venv_build_dir: "/opt/openstack-venv-builder"
repo_build_venv_dir: "{{ repo_build_base_path }}/venvs/{{ repo_build_release_tag }}/{{ repo_build_os_distro_version }}"
# We use find-links here in order to prefer the locally

View File

@ -62,13 +62,16 @@ pushd "{{ repo_build_venv_dir }}" &>/dev/null
[[ -d "${ROLE_VENV_PATH}" ]] && rm -rf "${ROLE_VENV_PATH}"
# If the pip build directory already exists, remove it
[[ -d "/tmp/${ROLE_VENV_FILE}" ]] && rm -rf "/tmp/${ROLE_VENV_FILE}"
[[ -d "/opt/${ROLE_VENV_FILE}" ]] && rm -rf "/opt/${ROLE_VENV_FILE}"
# Create the virtualenv shell
${VENV_CREATE_COMMAND} "${ROLE_VENV_PATH}" &>${ROLE_VENV_LOG}
# Create the pip build directory
mkdir -p "/tmp/${ROLE_VENV_FILE}"
mkdir -p "/opt/${ROLE_VENV_FILE}"
# Disable COW attributes on the build directory
chattr -R +C "/opt/${ROLE_VENV_FILE}" || true
# Activate the python virtual environment for good measure
source "${ROLE_VENV_PATH}/bin/activate"
@ -93,7 +96,7 @@ pushd "{{ repo_build_venv_dir }}" &>/dev/null
${ROLE_VENV_PATH}/bin/pip install \
--disable-pip-version-check \
--quiet --quiet \
--build "/tmp/${ROLE_VENV_FILE}" \
--build "/opt/${ROLE_VENV_FILE}" \
${PIP_INSTALL_OPTIONS} \
${PIP_INDEX_OPTIONS} \
${ROLE_VENV_REQUIREMENTS} \
@ -113,10 +116,9 @@ pushd "{{ repo_build_venv_dir }}" &>/dev/null
# Delete working directories
rm -rf "${ROLE_VENV_PATH}"
rm -rf "/tmp/${ROLE_VENV_FILE}"
rm -rf "/opt/${ROLE_VENV_FILE}"
popd &>/dev/null
# Output the end of the build
echo "done"