9 echo "Starting the Apex deployment."
10 echo "--------------------------------------------------------"
13 if [ -z "$DEPLOY_SCENARIO" ]; then
14 echo "Deploy scenario not set!"
17 echo "Deploy scenario: ${DEPLOY_SCENARIO}"
20 # Dev or RPM/ISO build
21 if [[ "$ARTIFACT_VERSION" =~ dev ]]; then
22 # Settings for deploying from git workspace
23 DEPLOY_SETTINGS_DIR="${WORKSPACE}/config/deploy"
24 NETWORK_SETTINGS_DIR="${WORKSPACE}/config/network"
25 DEPLOY_CMD="opnfv-deploy --image-dir ${WORKSPACE}/.build"
26 CLEAN_CMD="opnfv-clean"
27 # if we are using master, then we are downloading/caching upstream images
28 # we want to use that built in mechanism to avoid re-downloading every job
29 # so we use a dedicated folder to hold the upstream cache
30 UPSTREAM_CACHE=$HOME/upstream_cache
31 if [ "$BRANCH" == 'master' ]; then
32 mkdir -p ${UPSTREAM_CACHE}
33 RESOURCES=$UPSTREAM_CACHE
35 RESOURCES="${WORKSPACE}/.build/"
37 CONFIG="${WORKSPACE}/build"
40 LIB="${WORKSPACE}/lib"
42 # Ensure artifacts were downloaded and extracted correctly
43 # TODO(trozet) add verification here
46 sudo rm -rf /tmp/.build
48 sudo pip3 install --upgrade --force-reinstall .
49 mv -f /tmp/.build ${WORKSPACE}/
51 DEPLOY_SETTINGS_DIR="/etc/opnfv-apex/"
52 NETWORK_SETTINGS_DIR="/etc/opnfv-apex/"
53 DEPLOY_CMD="opnfv-deploy"
54 CLEAN_CMD="opnfv-clean"
55 # set to use different directory here because upon RPM removal this
56 # directory will be wiped in daily
57 UPSTREAM_CACHE=$HOME/upstream_cache
58 if [ "$BRANCH" == 'master' ]; then
59 mkdir -p ${UPSTREAM_CACHE}
60 RESOURCES=$UPSTREAM_CACHE
62 RESOURCES="/var/opt/opnfv/images"
64 CONFIG="/var/opt/opnfv"
67 LIB="/var/opt/opnfv/lib"
68 sudo mkdir -p /var/log/apex
69 sudo chmod 777 /var/log/apex
73 # Install Dependencies
74 # Make sure python34 dependencies are installed
75 dependencies="epel-release python34 python34-devel libvirt-devel python34-pip \
76 ansible python34-PyYAML python34-jinja2 python34-setuptools python-tox ansible"
78 for dep_pkg in $dependencies; do
79 if ! rpm -q ${dep_pkg} > /dev/null; then
80 if ! sudo yum install -y ${dep_pkg}; then
81 echo "Failed to install ${dep_pkg}"
87 if [[ "$JOB_NAME" =~ "virtual" ]]; then
88 # Make sure ipxe-roms-qemu package is updated to latest.
89 # This package is needed for multi virtio nic PXE boot in virtual environment.
90 sudo yum update -y ipxe-roms-qemu
93 if [ "$OPNFV_CLEAN" == 'yes' ]; then
94 if sudo test -e '/root/inventory/pod_settings.yaml'; then
95 clean_opts='-i /root/inventory/pod_settings.yaml'
100 sudo ${CLEAN_CMD} ${clean_opts}
103 if echo ${DEPLOY_SCENARIO} | grep ipv6; then
105 DEPLOY_SCENARIO=$(echo ${DEPLOY_SCENARIO} | sed 's/-ipv6//')
106 echo "INFO: IPV6 Enabled"
109 echo "Deploy Scenario set to ${DEPLOY_SCENARIO}"
110 DEPLOY_FILE="${DEPLOY_SETTINGS_DIR}/${DEPLOY_SCENARIO}.yaml"
112 if [ ! -e "$DEPLOY_FILE" ]; then
113 echo "ERROR: Required settings file missing: Deploy settings file ${DEPLOY_FILE}"
116 if [[ "$JOB_NAME" =~ "virtual" ]]; then
117 # settings for virtual deployment
118 DEPLOY_CMD="${DEPLOY_CMD} -v"
119 if [[ "${DEPLOY_SCENARIO}" =~ fdio|ovs ]]; then
120 DEPLOY_CMD="${DEPLOY_CMD} --virtual-default-ram 12 --virtual-compute-ram 7"
122 if [[ "$JOB_NAME" == *csit* ]]; then
123 DEPLOY_CMD="${DEPLOY_CMD} -e csit-environment.yaml"
125 if [[ "$PROMOTE" == "True" ]]; then
126 DEPLOY_CMD="${DEPLOY_CMD} --virtual-computes 1"
129 # settings for bare metal deployment
130 NETWORK_SETTINGS_DIR="/root/network"
131 INVENTORY_FILE="/root/inventory/pod_settings.yaml"
133 if ! sudo test -e "$INVENTORY_FILE"; then
134 echo "ERROR: Required settings file missing: Inventory settings file ${INVENTORY_FILE}"
137 # include inventory file for bare metal deployment
138 DEPLOY_CMD="${DEPLOY_CMD} -i ${INVENTORY_FILE}"
141 if [[ "$BRANCH" == "master" ]]; then
142 echo "Upstream deployment detected"
143 DEPLOY_CMD="${DEPLOY_CMD} --upstream"
146 if [ "$IPV6_FLAG" == "True" ]; then
147 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings_v6.yaml"
149 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings.yaml"
152 # Check that network settings file exists
153 if ! sudo test -e "$NETWORK_FILE"; then
154 echo "ERROR: Required settings file missing: Network Settings file ${NETWORK_FILE}"
159 sudo ${DEPLOY_CMD} -d ${DEPLOY_FILE} -n ${NETWORK_FILE} --debug
161 if [[ "$JOB_NAME" == *csit* ]]; then
162 echo "CSIT job: setting host route for floating ip routing"
163 # csit route to allow docker container to reach floating ips
164 UNDERCLOUD=$(sudo virsh domifaddr undercloud | grep -Eo "[0-9\.]+{3}[0-9]+")
165 if sudo route | grep 192.168.37.128 > /dev/null; then
166 sudo route del -net 192.168.37.128 netmask 255.255.255.128
168 sudo route add -net 192.168.37.128 netmask 255.255.255.128 gw ${UNDERCLOUD}
172 echo "--------------------------------------------------------"