9 echo "Starting the Apex deployment."
10 echo "--------------------------------------------------------"
15 if [ -z "$DEPLOY_SCENARIO" ]; then
16 echo "Deploy scenario not set!"
18 elif [[ "$DEPLOY_SCENARIO" == *gate* ]]; then
19 echo "Detecting Gating scenario..."
20 if [ -z "$GERRIT_EVENT_COMMENT_TEXT" ]; then
21 echo "ERROR: Gate job triggered without comment!"
24 DEPLOY_SCENARIO=$(echo ${GERRIT_EVENT_COMMENT_TEXT} | grep start-gate-scenario | grep -Eo 'os-.*$')
25 if [ -z "$DEPLOY_SCENARIO" ]; then
26 echo "ERROR: Unable to detect scenario in Gerrit Comment!"
27 echo "Format of comment to trigger gate should be 'start-gate-scenario: <scenario>'"
30 echo "Gate scenario detected: ${DEPLOY_SCENARIO}"
35 # Dev or RPM/ISO build
36 if [[ "$ARTIFACT_VERSION" =~ dev ]]; then
37 # Settings for deploying from git workspace
38 DEPLOY_SETTINGS_DIR="${WORKSPACE}/config/deploy"
39 NETWORK_SETTINGS_DIR="${WORKSPACE}/config/network"
40 DEPLOY_CMD="opnfv-deploy --image-dir ${WORKSPACE}/.build"
41 CLEAN_CMD="${WORKSPACE}/ci/clean.sh"
42 RESOURCES="${WORKSPACE}/.build/"
43 CONFIG="${WORKSPACE}/build"
46 LIB="${WORKSPACE}/lib"
48 # Ensure artifacts were downloaded and extracted correctly
49 # TODO(trozet) add verification here
55 sudo pip3 install --upgrade --force-reinstall .
58 DEPLOY_SETTINGS_DIR="/etc/opnfv-apex/"
59 NETWORK_SETTINGS_DIR="/etc/opnfv-apex/"
60 DEPLOY_CMD="opnfv-deploy"
61 CLEAN_CMD="opnfv-clean"
62 RESOURCES="/var/opt/opnfv/images"
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 2"
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 [ "$IPV6_FLAG" == "True" ]; then
141 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings_v6.yaml"
142 elif echo ${DEPLOY_SCENARIO} | grep fdio; then
143 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings_vpp.yaml"
145 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings.yaml"
148 # Check that network settings file exists
149 if ! sudo test -e "$NETWORK_FILE"; then
150 echo "ERROR: Required settings file missing: Network Settings file ${NETWORK_FILE}"
155 sudo ${DEPLOY_CMD} -d ${DEPLOY_FILE} -n ${NETWORK_FILE} --debug
157 if [[ "$JOB_NAME" == *csit* ]]; then
158 echo "CSIT job: setting host route for floating ip routing"
159 # csit route to allow docker container to reach floating ips
160 UNDERCLOUD=$(sudo virsh domifaddr undercloud | grep -Eo "[0-9\.]+{3}[0-9]+")
161 if sudo route | grep 192.168.37.128 > /dev/null; then
162 sudo route del -net 192.168.37.128 netmask 255.255.255.128
164 sudo route add -net 192.168.37.128 netmask 255.255.255.128 gw ${UNDERCLOUD}
168 echo "--------------------------------------------------------"