#!/bin/bash # # Copyright 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. NODEPOOL_KEY=$HOME/.ssh/id_nodepool NODEPOOL_KEY_NAME=root NODEPOOL_PUBKEY=$HOME/.ssh/id_nodepool.pub NODEPOOL_INSTALL=$HOME/nodepool-venv NODEPOOL_CACHE_GET_PIP=/opt/stack/cache/files/get-pip.py function install_diskimage_builder { if use_library_from_git "diskimage-builder"; then GITREPO["diskimage-builder"]=$DISKIMAGE_BUILDER_REPO_URL GITDIR["diskimage-builder"]=$DEST/diskimage-builder GITBRANCH["diskimage-builder"]=$DISKIMAGE_BUILDER_REPO_REF git_clone_by_name "diskimage-builder" setup_dev_lib "diskimage-builder" $NODEPOOL_INSTALL/bin/pip install $DEST/diskimage-builder fi } function install_glean { if use_library_from_git "glean"; then GITREPO["glean"]=$GLEAN_REPO_URL GITDIR["glean"]=$DEST/glean GITBRANCH["glean"]=$GLEAN_REPO_REF git_clone_by_name "glean" setup_dev_lib "glean" $NODEPOOL_INSTALL/bin/pip install $DEST/glean fi } function install_openstacksdk { if use_library_from_git "openstacksdk"; then git_clone_by_name "openstacksdk" $NODEPOOL_INSTALL/bin/pip install $DEST/openstacksdk fi } # Install nodepool code function install_nodepool { VENV="virtualenv -p python3" $VENV $NODEPOOL_INSTALL install_diskimage_builder install_glean setup_develop $DEST/nodepool $NODEPOOL_INSTALL/bin/pip install $DEST/nodepool # TODO(mordred) Install openstacksdk after nodepool so that if we're # in the -src job we don't re-install from the requirement. # We should make this more resilient, probably using install-siblings. install_openstacksdk $NODEPOOL_INSTALL/bin/pbr freeze } # requires some globals from devstack, which *might* not be stable api # points. If things break, investigate changes in those globals first. function nodepool_create_keypairs { if [[ ! -f $NODEPOOL_KEY ]]; then ssh-keygen -f $NODEPOOL_KEY -P "" fi cat > /tmp/ssh_wrapper < /tmp/40-nodepool-setup < /tmp/50-apt-allow-unauthenticated < /tmp/logging.conf < /tmp/secure.conf << EOF # Empty EOF sudo mv /tmp/secure.conf $NODEPOOL_SECURE sudo mkdir /var/log/nodepool sudo chown -R stack:stack /var/log/nodepool if use_library_from_git "glean"; then git --git-dir=$DEST/glean/.git checkout -b devstack DIB_GLEAN_INSTALLTYPE="DIB_INSTALLTYPE_simple_init: 'repo'" DIB_GLEAN_REPOLOCATION="DIB_REPOLOCATION_glean: '$DEST/glean'" DIB_GLEAN_REPOREF="DIB_REPOREF_glean: 'devstack'" fi if [ -f $NODEPOOL_CACHE_GET_PIP ] ; then DIB_GET_PIP="DIB_REPOLOCATION_pip_and_virtualenv: file://$NODEPOOL_CACHE_GET_PIP" fi if [ -f /etc/ci/mirror_info.sh ] ; then source /etc/ci/mirror_info.sh DIB_DISTRIBUTION_MIRROR_CENTOS="DIB_DISTRIBUTION_MIRROR: $NODEPOOL_CENTOS_MIRROR" DIB_DISTRIBUTION_MIRROR_DEBIAN="DIB_DISTRIBUTION_MIRROR: $NODEPOOL_DEBIAN_MIRROR" DIB_DISTRIBUTION_MIRROR_UBUNTU="DIB_DISTRIBUTION_MIRROR: $NODEPOOL_UBUNTU_MIRROR" DIB_DEBOOTSTRAP_EXTRA_ARGS="DIB_DEBOOTSTRAP_EXTRA_ARGS: '--no-check-gpg'" fi NODEPOOL_CENTOS_7_MIN_READY=1 NODEPOOL_DEBIAN_STRETCH_MIN_READY=1 NODEPOOL_FEDORA_29_MIN_READY=1 NODEPOOL_UBUNTU_BIONIC_MIN_READY=1 NODEPOOL_UBUNTU_TRUSTY_MIN_READY=1 NODEPOOL_UBUNTU_XENIAL_MIN_READY=1 NODEPOOL_OPENSUSE_423_MIN_READY=1 NODEPOOL_OPENSUSE_150_MIN_READY=1 NODEPOOL_OPENSUSE_TUMBLEWEED_MIN_READY=1 NODEPOOL_GENTOO_17_0_SYSTEMD_MIN_READY=1 if $NODEPOOL_PAUSE_CENTOS_7_DIB ; then NODEPOOL_CENTOS_7_MIN_READY=0 fi if $NODEPOOL_PAUSE_DEBIAN_STRETCH_DIB ; then NODEPOOL_DEBIAN_STRETCH_MIN_READY=0 fi if $NODEPOOL_PAUSE_FEDORA_29_DIB ; then NODEPOOL_FEDORA_29_MIN_READY=0 fi if $NODEPOOL_PAUSE_UBUNTU_BIONIC_DIB ; then NODEPOOL_UBUNTU_BIONIC_MIN_READY=0 fi if $NODEPOOL_PAUSE_UBUNTU_TRUSTY_DIB ; then NODEPOOL_UBUNTU_TRUSTY_MIN_READY=0 fi if $NODEPOOL_PAUSE_UBUNTU_XENIAL_DIB ; then NODEPOOL_UBUNTU_XENIAL_MIN_READY=0 fi if $NODEPOOL_PAUSE_OPENSUSE_423_DIB ; then NODEPOOL_OPENSUSE_423_MIN_READY=0 fi if $NODEPOOL_PAUSE_OPENSUSE_150_DIB ; then NODEPOOL_OPENSUSE_150_MIN_READY=0 fi if $NODEPOOL_PAUSE_OPENSUSE_TUMBLEWEED_DIB ; then NODEPOOL_OPENSUSE_TUMBLEWEED_MIN_READY=0 fi if $NODEPOOL_PAUSE_GENTOO_17_0_SYSTEMD_DIB; then NODEPOOL_GENTOO_17_0_SYSTEMD_MIN_READY=0 fi cat > /tmp/nodepool.yaml <>/tmp/clouds.yaml <