From b940e7b7de75bb0842ee36330e69103a98bd3a14 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Sun, 30 Aug 2015 01:16:20 +0100 Subject: [PATCH] Set the Ubuntu mirror used based on the environment Apt updates/installs are the most common cause of build timeouts within HP Cloud gate checks. This patch changes both the AIO and the gate check from using the Rackspace Ubuntu mirror for everything to: 1) The AIO bootstrap will use whichever mirror is already defined on the host operating system. 2) The gate check will use a known mirror which is defined per cloud provider. If the cloud provider is not known, or the script is being used outside of OpenStack-CI, then the gate checkwill fall back to using the AIO's mechanism. The idea is to make use of an apt mirror that is as close to the instance as possible in order to speed up apt updates and installs. Closes-Bug: #1491749 Change-Id: Ia37100bc198b64b74f27ea98ec5956e7cf084883 --- scripts/bootstrap-aio.sh | 23 +++++++++-------------- scripts/gate-check-commit.sh | 12 ++++++++++++ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/scripts/bootstrap-aio.sh b/scripts/bootstrap-aio.sh index d67ab3c636..ec31084bbd 100755 --- a/scripts/bootstrap-aio.sh +++ b/scripts/bootstrap-aio.sh @@ -44,10 +44,10 @@ export NEUTRON_FATAL_DEPRECATIONS=${NEUTRON_FATAL_DEPRECATIONS:-"no"} export NOVA_FATAL_DEPRECATIONS=${NOVA_FATAL_DEPRECATIONS:-"no"} export TEMPEST_FATAL_DEPRECATIONS=${TEMPEST_FATAL_DEPRECATIONS:-"no"} -# Ubuntu repos +# Ubuntu Repository Determination (based on existing host OS configuration) UBUNTU_RELEASE=$(lsb_release -sc) -UBUNTU_REPO=${UBUNTU_REPO:-"https://mirror.rackspace.com/ubuntu"} -UBUNTU_SEC_REPO=${UBUNTU_SEC_REPO:-"https://mirror.rackspace.com/ubuntu"} +UBUNTU_REPO=${UBUNTU_REPO:-$(awk "/^deb .*ubuntu\/? ${UBUNTU_RELEASE} main/ {print \$2; exit}" /etc/apt/sources.list)} +UBUNTU_SEC_REPO=${UBUNTU_SEC_REPO:-$(awk "/^deb .*ubuntu\/? ${UBUNTU_RELEASE}-security main/ {print \$2; exit}" /etc/apt/sources.list)} ## Library Check ------------------------------------------------------------- @@ -78,19 +78,14 @@ apt-get update && apt-get install -y apt-transport-https # Set the host repositories to only use the same ones, always, for the sake of consistency. cat > /etc/apt/sources.list <