diff options
author | C.J. Collier <cjcollier@linuxfoundation.org> | 2016-07-19 15:00:27 -0700 |
---|---|---|
committer | C.J. Collier <cjcollier@linuxfoundation.org> | 2016-07-20 16:37:20 -0700 |
commit | 6cd88df5afbb7226a67b7de518d83cde1cdb8eec (patch) | |
tree | 11deabb9c6b92acd595dc84eac23fac08f6d1132 /scripts | |
parent | a96e385f192653e3f681a7ce183f7f76c7672d0f (diff) |
Improvements to re-spin scripts
* Skip tasks which have already been completed
* correct bugs in variable definition order
* Respin::latest_src_age being called with arguments to perl -e to
ease interpolation
* Writing environment changes to .bashrc instead of .bash_profile
Change-Id: I95b07d4ccb510fb5cc0afdefc6b7521f9992463b
Signed-off-by: C.J. Collier <cjcollier@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/init-respin-env.sh | 39 | ||||
-rwxr-xr-x | scripts/respin-jcloud-images.sh | 32 |
2 files changed, 43 insertions, 28 deletions
diff --git a/scripts/init-respin-env.sh b/scripts/init-respin-env.sh index 6ecfe8363..47ec61c82 100644 --- a/scripts/init-respin-env.sh +++ b/scripts/init-respin-env.sh @@ -9,11 +9,13 @@ ruby_version=2.1.5 ruby_patch=https://gist.github.com/mislav/055441129184a1512bb5.txt rbenv_git=https://github.com/rbenv/rbenv.git +CPPROJECT=fdio + PVENAME="${CPPROJECT}-openstack" +PVE_ROOT="${HOME}/src/python-virtual" PVE_PATH="${PVE_ROOT}/${PVENAME}" PVERC=${PVE_PATH}/bin/activate PVE_BINDIR=$(dirname $PVERC) -PVE_ROOT="${HOME}/src/python-virtual" LOCAL_LIB="${HOME}/src/local-lib" LL_LIBDIR="${LOCAL_LIB}/lib" @@ -26,17 +28,6 @@ LV_IMG_DIR=/var/lib/libvirt/images/ SRC_TIMESTAMP="" DST_TIMESTAMP="" -init_virtualenv -init_rbenv -init_ruby -select_ruby ${ruby_version} -init_virtualenv -init_vagrant -install_vagrant_plugins -import_vagrant_box -init_local_lib -init_javascript - function init_virtualenv () { test -d ${PVE_BINDIR} && return 0 @@ -84,8 +75,8 @@ function init_vagrant () vagrant_pkg_name=vagrant_${vagrant_version}_x86_64.deb vagrant_pkg=https://releases.hashicorp.com/vagrant/${vagrant_version}/${vagrant_pkg_name} - wget -c ${vagrant_pkg} - sudo dpkg -i ${vagrant_pkg_name} + wget -t 10 -q -c /tmp/${vagrant_pkg} + sudo dpkg -i /vagrant/${vagrant_pkg_name} } function init_rbenv () @@ -103,7 +94,7 @@ function init_rbenv () cd ~/.rbenv && src/configure && make -C src # Add rbenv to bashrc - grep HOME/.rbenv/bin ~/.bash_profile || echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile + grep HOME/.rbenv/bin ~/.bashrc || echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc # Add rbenv to current environment export PATH="$HOME/.rbenv/bin:$PATH" @@ -111,6 +102,8 @@ function init_rbenv () function init_ruby () { + rbenv versions | grep -q ${ruby_version} && return 0 + # Install ruby build deps sudo apt-get build-dep ruby #sudo apt-get -y install \ @@ -130,17 +123,33 @@ function select_ruby () function install_vagrant_plugins () { + plugs=$(vagrant plugin list) for plugin in vagrant-openstack-provider vagrant-cachier vagrant-mutate do + echo ${plugs} | grep -q ${plugin} && continue vagrant plugin install ${plugin} done } function import_vagrant_box () { + # Skip if already done + if [ -f ${HOME}/.vagrant.d/boxes/dummy/0/openstack/Vagrantfile ]; then return ; fi + # Add dummy box vagrant box add dummy https://github.com/huit/vagrant-openstack/blob/master/dummy.box cp ${CI_MGMT}/vagrant/examples/box/dummy/Vagrantfile ~/.vagrant.d/boxes/dummy/0/openstack/ } + +init_virtualenv +init_rbenv +init_ruby +select_ruby ${ruby_version} +init_virtualenv +init_vagrant +install_vagrant_plugins +import_vagrant_box +init_local_lib +init_javascript diff --git a/scripts/respin-jcloud-images.sh b/scripts/respin-jcloud-images.sh index 2af9e4c1b..f86c81644 100755 --- a/scripts/respin-jcloud-images.sh +++ b/scripts/respin-jcloud-images.sh @@ -13,6 +13,24 @@ CI_MGMT=$(realpath $(dirname $(realpath $0))/..) source ${CI_MGMT}/vagrant/lib/respin-functions.sh source ${PVERC} +VAGRANT_DIR=${CI_MGMT}/vagrant/basebuild + +# Fetch MVN package +MAVEN_MIRROR=apache.mirrors.tds.net +MAVEN_VERSION=3.3.9 +MAVEN_FILENAME=apache-maven-${MAVEN_VERSION}-bin.tar.gz +MAVEN_RELEASE=http://${MAVEN_MIRROR}/maven/maven-3/${MAVEN_VERSION}/binaries/${MAVEN_FILENAME} + +TRIES=10 + +wget -t ${TRIES} -q -O ${VAGRANT_DIR}/${MAVEN_FILENAME} ${MAVEN_RELEASE} + +# Fetch EPEL package +EPEL_RPM=epel-release-latest-7.noarch.rpm +EPEL_RELEASE=https://dl.fedoraproject.org/pub/epel/${EPEL_RPM} + +wget -t ${TRIES} -q -O ${VAGRANT_DIR}/${EPEL_RPM} ${EPEL_RELEASE} + echo nova: $(which nova) export NETID=${NETID:-$(nova network-list | awk "/${CPPROJECT}/ {print \$2}")} @@ -25,19 +43,7 @@ do ARCH="${DVA[2]}" DTYPE=$(dist_type ${DIST}) - AGE_JSON=$(latest_src_age ${DIST} ${VERSION} ${ARCH}); - - # only fetch new base image if our latest one is more than two weeks old - if [ $(echo ${AGE_JSON} | jq .week) -ge "3" ] - then - # Acquire bootstrap images - download_${DTYPE}_image "${DIST}" "${VERSION}" "${ARCH}" - - # Push images to openstack via glance - create_${DTYPE}_image "${DIST}" "${VERSION}" "${ARCH}" - fi - # Respin images - cd ${CI_MGMT}/vagrant/basebuild + cd ${VAGRANT_DIR} respin_${DTYPE}_image "${DIST}" "${VERSION}" "${ARCH}" done |