2016-01-12 20:52:00 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -o xtrace
|
|
|
|
set -o errexit
|
2020-03-15 14:16:04 +00:00
|
|
|
set -o pipefail
|
2016-01-12 20:52:00 +00:00
|
|
|
|
2016-04-08 12:44:16 +00:00
|
|
|
# Enable unbuffered output for Ansible in Jenkins.
|
|
|
|
export PYTHONUNBUFFERED=1
|
|
|
|
|
2016-12-01 10:50:42 +00:00
|
|
|
|
2019-07-15 18:44:43 +00:00
|
|
|
function setup_openstack_clients {
|
|
|
|
# Prepare virtualenv for openstack deployment tests
|
2020-02-25 10:22:27 +00:00
|
|
|
local packages=(python-openstackclient python-heatclient)
|
2019-11-20 13:25:16 +00:00
|
|
|
if [[ $SCENARIO == zun ]]; then
|
2020-02-25 10:22:27 +00:00
|
|
|
packages+=(python-zunclient)
|
2019-07-15 18:44:43 +00:00
|
|
|
fi
|
2019-11-20 13:25:16 +00:00
|
|
|
if [[ $SCENARIO == ironic ]]; then
|
2020-02-25 10:22:27 +00:00
|
|
|
packages+=(python-ironicclient)
|
2019-07-15 18:44:43 +00:00
|
|
|
fi
|
2019-11-20 13:25:16 +00:00
|
|
|
if [[ $SCENARIO == masakari ]]; then
|
2020-02-25 10:22:27 +00:00
|
|
|
packages+=(python-masakariclient)
|
2018-11-07 02:09:04 +00:00
|
|
|
fi
|
2020-06-12 19:33:22 +00:00
|
|
|
if [[ $SCENARIO == scenario_nfv ]]; then
|
|
|
|
packages+=(python-tackerclient python-barbicanclient python-mistralclient)
|
|
|
|
fi
|
2020-02-25 10:22:27 +00:00
|
|
|
if [[ "debian" == $BASE_DISTRO ]]; then
|
|
|
|
sudo apt -y install python3-venv
|
|
|
|
fi
|
|
|
|
python3 -m venv ~/openstackclient-venv
|
|
|
|
~/openstackclient-venv/bin/pip install -U pip
|
|
|
|
~/openstackclient-venv/bin/pip install -c $UPPER_CONSTRAINTS ${packages[@]}
|
2019-07-15 18:44:43 +00:00
|
|
|
}
|
|
|
|
|
2020-03-15 14:16:04 +00:00
|
|
|
function prepare_images {
|
|
|
|
if [[ "${BUILD_IMAGE}" == "False" ]]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2019-11-20 13:25:16 +00:00
|
|
|
if [[ $SCENARIO != "bifrost" ]]; then
|
2020-01-28 16:39:40 +00:00
|
|
|
GATE_IMAGES="^cron,^fluentd,^glance,^haproxy,^keepalived,^keystone,^kolla-toolbox,^mariadb,^memcached,^neutron,^nova-,^openvswitch,^rabbitmq,^horizon,^chrony,^heat,^placement"
|
2018-03-05 14:33:04 +00:00
|
|
|
else
|
|
|
|
GATE_IMAGES="bifrost"
|
|
|
|
fi
|
2017-07-10 08:37:45 +00:00
|
|
|
|
2019-08-14 09:13:29 +00:00
|
|
|
if [[ $SCENARIO == "ceph-ansible" ]]; then
|
2020-01-28 16:39:40 +00:00
|
|
|
GATE_IMAGES+=",^cinder"
|
2019-08-14 09:13:29 +00:00
|
|
|
fi
|
|
|
|
|
2019-11-20 13:25:16 +00:00
|
|
|
if [[ $SCENARIO == "zun" ]]; then
|
2020-01-28 16:39:40 +00:00
|
|
|
GATE_IMAGES+=",^zun,^kuryr,^etcd,^cinder,^iscsid"
|
2020-03-16 15:58:11 +00:00
|
|
|
if [[ $BASE_DISTRO != "centos" ]]; then
|
2020-01-28 16:39:40 +00:00
|
|
|
GATE_IMAGES+=",^tgtd"
|
2019-01-17 12:19:55 +00:00
|
|
|
fi
|
2018-04-30 15:17:27 +00:00
|
|
|
fi
|
|
|
|
|
2019-11-20 13:25:16 +00:00
|
|
|
if [[ $SCENARIO == "scenario_nfv" ]]; then
|
2020-01-28 16:39:40 +00:00
|
|
|
GATE_IMAGES+=",^tacker,^mistral,^redis,^barbican"
|
2018-11-07 17:16:32 +00:00
|
|
|
fi
|
2019-11-20 13:25:16 +00:00
|
|
|
if [[ $SCENARIO == "ironic" ]]; then
|
2020-01-28 16:39:40 +00:00
|
|
|
GATE_IMAGES+=",^dnsmasq,^ironic,^iscsid"
|
2018-05-16 12:36:38 +00:00
|
|
|
fi
|
2019-11-20 13:25:16 +00:00
|
|
|
if [[ $SCENARIO == "masakari" ]]; then
|
2020-01-28 16:39:40 +00:00
|
|
|
GATE_IMAGES+=",^masakari"
|
2018-11-07 02:09:04 +00:00
|
|
|
fi
|
2018-11-07 17:16:32 +00:00
|
|
|
|
2020-01-30 10:58:38 +00:00
|
|
|
if [[ $SCENARIO == "swift" ]]; then
|
|
|
|
GATE_IMAGES+=",^swift"
|
|
|
|
fi
|
|
|
|
|
2019-12-20 10:35:35 +00:00
|
|
|
if [[ $SCENARIO == "ovn" ]]; then
|
|
|
|
GATE_IMAGES+=",^ovn"
|
|
|
|
fi
|
|
|
|
|
2019-11-20 13:25:16 +00:00
|
|
|
if [[ $SCENARIO == "mariadb" ]]; then
|
2020-03-18 14:15:25 +00:00
|
|
|
GATE_IMAGES="^cron,^fluentd,^haproxy,^keepalived,^kolla-toolbox,^mariadb"
|
2019-04-25 10:18:35 +00:00
|
|
|
fi
|
|
|
|
|
2019-11-14 10:37:22 +00:00
|
|
|
# NOTE(yoctozepto): we cannot build and push at the same time on debian
|
|
|
|
# buster see https://github.com/docker/for-linux/issues/711.
|
|
|
|
PUSH="true"
|
|
|
|
if [[ "debian" == $BASE_DISTRO ]]; then
|
|
|
|
PUSH="false"
|
|
|
|
fi
|
2020-03-15 14:16:04 +00:00
|
|
|
|
|
|
|
sudo tee /etc/kolla/kolla-build.conf <<EOF
|
2016-11-16 17:21:01 +00:00
|
|
|
[DEFAULT]
|
|
|
|
namespace = lokolla
|
|
|
|
base = ${BASE_DISTRO}
|
|
|
|
install_type = ${INSTALL_TYPE}
|
2019-01-09 16:23:00 +00:00
|
|
|
tag = ${TAG}
|
2016-11-21 05:30:42 +00:00
|
|
|
profile = gate
|
2016-12-21 16:57:03 +00:00
|
|
|
registry = 127.0.0.1:4000
|
2019-11-14 10:37:22 +00:00
|
|
|
push = ${PUSH}
|
2018-11-07 11:14:48 +00:00
|
|
|
logs_dir = /tmp/logs/build
|
2019-06-27 15:58:13 +00:00
|
|
|
template_override = /etc/kolla/template_overrides.j2
|
2020-03-03 12:15:30 +00:00
|
|
|
# NOTE(yoctozepto): to avoid issues with IPv6 not enabled in the docker daemon
|
|
|
|
# and since we don't need isolated networks here, use host networking
|
|
|
|
network_mode = host
|
2016-12-13 06:35:18 +00:00
|
|
|
|
|
|
|
[profiles]
|
2017-07-10 08:37:45 +00:00
|
|
|
gate = ${GATE_IMAGES}
|
2016-11-16 17:21:01 +00:00
|
|
|
EOF
|
2016-09-01 13:27:05 +00:00
|
|
|
|
2018-11-08 17:18:53 +00:00
|
|
|
mkdir -p /tmp/logs/build
|
2016-01-12 20:52:00 +00:00
|
|
|
|
2017-11-15 02:12:54 +00:00
|
|
|
sudo docker run -d -p 4000:5000 --restart=always -v /opt/kolla_registry/:/var/lib/registry --name registry registry:2
|
2020-03-15 14:16:04 +00:00
|
|
|
|
|
|
|
python3 -m venv ~/kolla-venv
|
|
|
|
. ~/kolla-venv/bin/activate
|
|
|
|
|
|
|
|
pip install "${KOLLA_SRC_DIR}"
|
|
|
|
|
|
|
|
sudo ~/kolla-venv/bin/kolla-build
|
|
|
|
|
2019-11-14 10:37:22 +00:00
|
|
|
# NOTE(yoctozepto): due to debian buster we push after images are built
|
|
|
|
# see https://github.com/docker/for-linux/issues/711
|
|
|
|
if [[ "debian" == $BASE_DISTRO ]]; then
|
|
|
|
for img in $(sudo docker image ls --format '{{ .Repository }}:{{ .Tag }}' | grep lokolla/); do
|
|
|
|
sudo docker push $img;
|
|
|
|
done
|
|
|
|
fi
|
2020-03-15 14:16:04 +00:00
|
|
|
|
|
|
|
deactivate
|
2016-12-21 16:57:03 +00:00
|
|
|
}
|
|
|
|
|
2019-07-15 18:44:43 +00:00
|
|
|
|
2020-03-15 14:16:04 +00:00
|
|
|
setup_openstack_clients
|
2017-05-18 15:20:14 +00:00
|
|
|
|
2019-12-04 16:33:23 +00:00
|
|
|
RAW_INVENTORY=/etc/kolla/inventory
|
2019-07-02 18:44:33 +00:00
|
|
|
tools/kolla-ansible -i ${RAW_INVENTORY} -e ansible_user=$USER -vvv bootstrap-servers &> /tmp/logs/ansible/bootstrap-servers
|
2020-03-15 14:16:04 +00:00
|
|
|
|
2016-12-21 16:57:03 +00:00
|
|
|
prepare_images
|