9 echo "Starting the Apex deployment."
10 echo "--------------------------------------------------------"
13 if [ -z "$DEPLOY_SCENARIO" ]; then
14 echo "Deploy scenario not set!"
16 elif [[ "$DEPLOY_SCENARIO" == *gate* ]]; then
17 echo "Detecting Gating scenario..."
18 if [ -z "$GERRIT_EVENT_COMMENT_TEXT" ]; then
19 echo "ERROR: Gate job triggered without comment!"
22 DEPLOY_SCENARIO=$(echo ${GERRIT_EVENT_COMMENT_TEXT} | grep start-gate-scenario | grep -Eo 'os-.*$')
23 if [ -z "$DEPLOY_SCENARIO" ]; then
24 echo "ERROR: Unable to detect scenario in Gerrit Comment!"
25 echo "Format of comment to trigger gate should be 'start-gate-scenario: <scenario>'"
28 echo "Gate scenario detected: ${DEPLOY_SCENARIO}"
33 # Dev or RPM/ISO build
34 if [[ "$ARTIFACT_VERSION" =~ dev ]]; then
35 # Settings for deploying from git workspace
36 DEPLOY_SETTINGS_DIR="${WORKSPACE}/config/deploy"
37 NETWORK_SETTINGS_DIR="${WORKSPACE}/config/network"
38 DEPLOY_CMD="${WORKSPACE}/ci/deploy.sh"
39 CLEAN_CMD="${WORKSPACE}/ci/clean.sh"
40 RESOURCES="${WORKSPACE}/.build/"
41 CONFIG="${WORKSPACE}/build"
44 LIB="${WORKSPACE}/lib"
46 # Ensure artifacts were downloaded and extracted correctly
47 # TODO(trozet) add verification here
50 DEPLOY_SETTINGS_DIR="/etc/opnfv-apex/"
51 NETWORK_SETTINGS_DIR="/etc/opnfv-apex/"
52 DEPLOY_CMD="opnfv-deploy"
53 CLEAN_CMD="opnfv-clean"
54 RESOURCES="/var/opt/opnfv/images"
55 CONFIG="/var/opt/opnfv"
58 LIB="/var/opt/opnfv/lib"
62 # Install Dependencies
63 # Make sure python34 dependencies are installed
64 for dep_pkg in epel-release python34 python34-PyYAML python34-setuptools; do
65 if ! rpm -q ${dep_pkg} > /dev/null; then
66 if ! sudo yum install -y ${dep_pkg}; then
67 echo "Failed to install ${dep_pkg}"
73 # Make sure jinja2 is installed
74 for python_pkg in jinja2; do
75 if ! python3.4 -c "import $python_pkg"; then
76 echo "$python_pkg package not found for python3.4, attempting to install..."
77 if ! sudo easy_install-3.4 $python_pkg; then
78 echo -e "Failed to install $python_pkg package for python3.4"
84 if [[ "$JOB_NAME" =~ "virtual" ]]; then
85 # Make sure ipxe-roms-qemu package is updated to latest.
86 # This package is needed for multi virtio nic PXE boot in virtual environment.
87 sudo yum update -y ipxe-roms-qemu
88 if [ -z ${PYTHONPATH:-} ]; then
89 export PYTHONPATH=${WORKSPACE}/lib/python
91 export PYTHONPATH=$PYTHONPATH:${WORKSPACE}/lib/python
95 # set env vars to deploy cmd
96 DEPLOY_CMD="BASE=${BASE} IMAGES=${IMAGES} LIB=${LIB} ${DEPLOY_CMD}"
98 if [ "$OPNFV_CLEAN" == 'yes' ]; then
99 if sudo test -e '/root/inventory/pod_settings.yaml'; then
100 clean_opts='-i /root/inventory/pod_settings.yaml'
105 sudo BASE=${BASE} LIB=${LIB} ${CLEAN_CMD} ${clean_opts}
108 if echo ${DEPLOY_SCENARIO} | grep ipv6; then
110 DEPLOY_SCENARIO=$(echo ${DEPLOY_SCENARIO} | sed 's/-ipv6//')
111 echo "INFO: IPV6 Enabled"
114 echo "Deploy Scenario set to ${DEPLOY_SCENARIO}"
115 DEPLOY_FILE="${DEPLOY_SETTINGS_DIR}/${DEPLOY_SCENARIO}.yaml"
117 if [ ! -e "$DEPLOY_FILE" ]; then
118 echo "ERROR: Required settings file missing: Deploy settings file ${DEPLOY_FILE}"
121 if [[ "$JOB_NAME" =~ "virtual" ]]; then
122 # settings for virtual deployment
123 DEPLOY_CMD="${DEPLOY_CMD} -v"
124 if [[ "${DEPLOY_SCENARIO}" =~ fdio|ovs ]]; then
125 DEPLOY_CMD="${DEPLOY_CMD} --virtual-default-ram 12 --virtual-compute-ram 7"
127 if [[ "$JOB_NAME" == *csit* ]]; then
128 DEPLOY_CMD="${DEPLOY_CMD} -e csit-environment.yaml"
130 if [[ "$PROMOTE" == "True" ]]; then
131 DEPLOY_CMD="${DEPLOY_CMD} --virtual-computes 2"
134 # settings for bare metal deployment
135 NETWORK_SETTINGS_DIR="/root/network"
136 INVENTORY_FILE="/root/inventory/pod_settings.yaml"
138 if ! sudo test -e "$INVENTORY_FILE"; then
139 echo "ERROR: Required settings file missing: Inventory settings file ${INVENTORY_FILE}"
142 # include inventory file for bare metal deployment
143 DEPLOY_CMD="${DEPLOY_CMD} -i ${INVENTORY_FILE}"
146 if [ "$IPV6_FLAG" == "True" ]; then
147 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings_v6.yaml"
148 elif echo ${DEPLOY_SCENARIO} | grep fdio; then
149 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings_vpp.yaml"
151 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings.yaml"
154 # Check that network settings file exists
155 if ! sudo test -e "$NETWORK_FILE"; then
156 echo "ERROR: Required settings file missing: Network Settings file ${NETWORK_FILE}"
161 sudo ${DEPLOY_CMD} -d ${DEPLOY_FILE} -n ${NETWORK_FILE} --debug
163 if [[ "$JOB_NAME" == *csit* ]]; then
164 echo "CSIT job: setting host route for floating ip routing"
165 # csit route to allow docker container to reach floating ips
166 UNDERCLOUD=$(sudo virsh domifaddr undercloud | grep -Eo "[0-9\.]+{3}[0-9]+")
167 if sudo route | grep 192.168.37.128 > /dev/null; then
168 sudo route del -net 192.168.37.128 netmask 255.255.255.128
170 sudo route add -net 192.168.37.128 netmask 255.255.255.128 gw ${UNDERCLOUD}
174 echo "--------------------------------------------------------"