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 CLEAN_CMD="opnfv-clean"
26 # if we are using master, then we are downloading/caching upstream images
27 # we want to use that built in mechanism to avoid re-downloading every job
28 # so we use a dedicated folder to hold the upstream cache
29 UPSTREAM_CACHE=$HOME/upstream_cache
30 if [ "$BRANCH" == 'master' ]; then
31 mkdir -p ${UPSTREAM_CACHE}
32 RESOURCES=$UPSTREAM_CACHE
34 RESOURCES="${WORKSPACE}/.build/"
36 CONFIG="${WORKSPACE}/build"
39 LIB="${WORKSPACE}/lib"
40 DEPLOY_CMD="opnfv-deploy --image-dir ${RESOURCES}"
41 # Ensure artifacts were downloaded and extracted correctly
42 # TODO(trozet) add verification here
45 sudo rm -rf /tmp/.build
47 sudo pip3 install --upgrade --force-reinstall .
48 mv -f /tmp/.build ${WORKSPACE}/
50 DEPLOY_SETTINGS_DIR="/etc/opnfv-apex/"
51 NETWORK_SETTINGS_DIR="/etc/opnfv-apex/"
52 CLEAN_CMD="opnfv-clean"
53 # set to use different directory here because upon RPM removal this
54 # directory will be wiped in daily
55 UPSTREAM_CACHE=$HOME/upstream_cache
56 if [ "$BRANCH" == 'master' ]; then
57 mkdir -p ${UPSTREAM_CACHE}
58 RESOURCES=$UPSTREAM_CACHE
60 RESOURCES="/var/opt/opnfv/images"
62 DEPLOY_CMD="opnfv-deploy --image-dir ${RESOURCES}"
63 CONFIG="/var/opt/opnfv"
66 LIB="/var/opt/opnfv/lib"
67 sudo mkdir -p /var/log/apex
68 sudo chmod 777 /var/log/apex
72 # Install Dependencies
73 # Make sure python34 dependencies are installed
74 dependencies="epel-release python34 python34-devel libvirt-devel python34-pip \
75 ansible python34-PyYAML python34-jinja2 python34-setuptools python-tox ansible"
77 for dep_pkg in $dependencies; do
78 if ! rpm -q ${dep_pkg} > /dev/null; then
79 if ! sudo yum install -y ${dep_pkg}; then
80 echo "Failed to install ${dep_pkg}"
86 if [[ "$JOB_NAME" =~ "virtual" ]]; then
87 # Make sure ipxe-roms-qemu package is updated to latest.
88 # This package is needed for multi virtio nic PXE boot in virtual environment.
89 sudo yum update -y ipxe-roms-qemu
92 if [ "$OPNFV_CLEAN" == 'yes' ]; then
93 if sudo test -e '/root/inventory/pod_settings.yaml'; then
94 clean_opts='-i /root/inventory/pod_settings.yaml'
99 sudo ${CLEAN_CMD} ${clean_opts}
102 if echo ${DEPLOY_SCENARIO} | grep ipv6; then
104 DEPLOY_SCENARIO=$(echo ${DEPLOY_SCENARIO} | sed 's/-ipv6//')
105 echo "INFO: IPV6 Enabled"
108 echo "Deploy Scenario set to ${DEPLOY_SCENARIO}"
109 DEPLOY_FILE="${DEPLOY_SETTINGS_DIR}/${DEPLOY_SCENARIO}.yaml"
111 if [ ! -e "$DEPLOY_FILE" ]; then
112 echo "ERROR: Required settings file missing: Deploy settings file ${DEPLOY_FILE}"
115 if [[ "$JOB_NAME" =~ "virtual" ]]; then
116 # settings for virtual deployment
117 DEPLOY_CMD="${DEPLOY_CMD} -v"
118 if [[ "${DEPLOY_SCENARIO}" =~ fdio|ovs ]]; then
119 DEPLOY_CMD="${DEPLOY_CMD} --virtual-default-ram 12 --virtual-compute-ram 7"
121 if [[ "$JOB_NAME" == *csit* ]]; then
122 DEPLOY_CMD="${DEPLOY_CMD} -e csit-environment.yaml"
124 if [[ "$PROMOTE" == "True" ]]; then
125 DEPLOY_CMD="${DEPLOY_CMD} --virtual-computes 1"
128 # settings for bare metal deployment
129 NETWORK_SETTINGS_DIR="/root/network"
130 INVENTORY_FILE="/root/inventory/pod_settings.yaml"
132 if ! sudo test -e "$INVENTORY_FILE"; then
133 echo "ERROR: Required settings file missing: Inventory settings file ${INVENTORY_FILE}"
136 # include inventory file for bare metal deployment
137 DEPLOY_CMD="${DEPLOY_CMD} -i ${INVENTORY_FILE}"
140 if [[ "$BRANCH" == "master" ]]; then
141 echo "Upstream deployment detected"
142 DEPLOY_CMD="${DEPLOY_CMD} --upstream"
145 if [ "$IPV6_FLAG" == "True" ]; then
146 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings_v6.yaml"
148 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings.yaml"
151 # Check that network settings file exists
152 if ! sudo test -e "$NETWORK_FILE"; then
153 echo "ERROR: Required settings file missing: Network Settings file ${NETWORK_FILE}"
158 sudo ${DEPLOY_CMD} -d ${DEPLOY_FILE} -n ${NETWORK_FILE} --debug
160 if [[ "$JOB_NAME" == *csit* ]]; then
161 echo "CSIT job: setting host route for floating ip routing"
162 # csit route to allow docker container to reach floating ips
163 UNDERCLOUD=$(sudo virsh domifaddr undercloud | grep -Eo "[0-9\.]+{3}[0-9]+")
164 if sudo route | grep 192.168.37.128 > /dev/null; then
165 sudo route del -net 192.168.37.128 netmask 255.255.255.128
167 sudo route add -net 192.168.37.128 netmask 255.255.255.128 gw ${UNDERCLOUD}
171 echo "--------------------------------------------------------"