Pre-cache UCA packages during nodepool img build
While caching packages required by devstack, temporarily enable the Ubuntu Cloud Archive for specified pockets and do additional deb package caching. This will pre-cache UCA versions of devstack dependencies alongside the standard 12.04 requirements. After they have been cached, the repository access is removed. This allows standard devstack jobs to use the vanilla 12.04 packages as usual, and jobs that require UCA can enable it and use it without hitting the network for either the GPG key or the packages. Change-Id: I1cad663a71a3129dc97347dd4d39a760e432aff2 Closes-bug: #1329430.
This commit is contained in:
parent
33275e78f4
commit
617919da41
@ -25,6 +25,11 @@ from common import run_local
|
||||
DEVSTACK = os.path.expanduser('/opt/git/openstack-dev/devstack')
|
||||
CACHEDIR = os.path.expanduser('~/cache/files')
|
||||
|
||||
# Some jobs require newer distro packages. We pre-cache deb packages from
|
||||
# specified Ubuntu Cloud Archive pockets. The icehouse pocket contains
|
||||
# Ubuntu 14.04 packages built for 12.04.
|
||||
UCA_POCKETS = ['icehouse']
|
||||
|
||||
|
||||
def git_branches():
|
||||
branches = []
|
||||
@ -133,6 +138,24 @@ def download(url, fname):
|
||||
run_local(['wget', '-nv', '-c', url, '-O', os.path.join(CACHEDIR, fname)])
|
||||
|
||||
|
||||
def cache_debs(debs, uca_pocket=None):
|
||||
"""Cache a list of deb packages, optionally pulling from an Ubuntu Cloud
|
||||
Archive pocket. If a UCA pocket is specified, it is enabled temporarily
|
||||
for caching only.
|
||||
"""
|
||||
if uca_pocket:
|
||||
# Note this will install the ubuntu-cloud-keyring package which
|
||||
# contains the required GPG key.
|
||||
run_local(['sudo', 'add-apt-repository', '-y',
|
||||
'cloud-archive:%s' % uca_pocket])
|
||||
run_local(['sudo', 'apt-get', 'update'])
|
||||
run_local(['sudo', 'apt-get', '-y', '-d', 'install'] + debs)
|
||||
if uca_pocket:
|
||||
run_local(['sudo', 'rm', '-f',
|
||||
'/etc/apt/sources.list.d/cloudarchive-%s.list' % uca_pocket])
|
||||
run_local(['sudo', 'apt-get', 'update'])
|
||||
|
||||
|
||||
def main():
|
||||
distribution = sys.argv[1]
|
||||
|
||||
@ -140,8 +163,9 @@ def main():
|
||||
image_filenames = []
|
||||
for branch_data in branches:
|
||||
if branch_data.get('debs'):
|
||||
run_local(['sudo', 'apt-get', '-y', '-d', 'install'] +
|
||||
branch_data['debs'])
|
||||
cache_debs(branch_data['debs'])
|
||||
for uca in sorted(UCA_POCKETS):
|
||||
cache_debs(branch_data['debs'], uca)
|
||||
elif branch_data.get('rpms'):
|
||||
run_local(['sudo', 'yum', 'install', '-y', '--downloadonly'] +
|
||||
branch_data['rpms'])
|
||||
|
@ -26,7 +26,7 @@ elif [ -f /usr/bin/apt-get ]; then
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get \
|
||||
--option "Dpkg::Options::=--force-confold" \
|
||||
--assume-yes install build-essential python-dev \
|
||||
linux-headers-virtual linux-headers-`uname -r`
|
||||
python-software-properties linux-headers-virtual linux-headers-`uname -r`
|
||||
else
|
||||
echo "Unsupported distro."
|
||||
exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user