warm pip wheel cache during image build
This installs everything in upper-constraints in a throw away venv, which has the knock on effect of fully populating the wheel cache for root with wheels for everything. This hopefully speeds up all devstack runs quite a bit. Change-Id: I429f353c33d892f76552c83d34ac1329ed18f97f
This commit is contained in:
parent
7873adca0d
commit
1503ef3278
48
nodepool/elements/cache-devstack/install.d/60-pip-warm-cache
Executable file
48
nodepool/elements/cache-devstack/install.d/60-pip-warm-cache
Executable file
@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Copyright (C) 2015 Hewlett-Packard Development Company, L.P.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
# implied.
|
||||||
|
#
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# dib-lint: disable=setpipefail
|
||||||
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
REQUIREMENTS_DIR=/opt/git/openstack/requirements
|
||||||
|
BUILDPIP_VENV=$(mktemp -d)
|
||||||
|
UC_FILE=$BUILDPIP_VENV/uc.txt
|
||||||
|
|
||||||
|
# Setup venv and install all of the global requirements. This will
|
||||||
|
# create a warm pip cache which can be used by devstack later.
|
||||||
|
sudo virtualenv $BUILDPIP_VENV
|
||||||
|
|
||||||
|
# Loop through all possible branches
|
||||||
|
BRANCHES=`git --git-dir=$REQUIREMENTS_DIR/.git branch -r | grep '^ origin/[^H]'`
|
||||||
|
for BRANCH in $BRANCHES ; do
|
||||||
|
git --git-dir=$REQUIREMENTS_DIR/.git show $BRANCH:upper-constraints.txt \
|
||||||
|
2>/dev/null > $UC_FILE || true
|
||||||
|
if [[ -f $UC_FILE ]]; then
|
||||||
|
# install all the upper-constraints
|
||||||
|
sudo -H $BUILDPIP_VENV/bin/pip install -r $UC_FILE
|
||||||
|
# remove the file at the end to ensure that we don't use an
|
||||||
|
# old one for this branch
|
||||||
|
rm -f $UC_FILE
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Delete the venv after the script, we don't care about the venv, just
|
||||||
|
# the cache artifacts left around.
|
||||||
|
sudo rm -rf $BUILDPIP_VENV
|
Loading…
Reference in New Issue
Block a user