10 echo "Starting the Apex deployment."
11 echo "--------------------------------------------------------"
14 if [ -z "$DEPLOY_SCENARIO" ]; then
15 echo "Deploy scenario not set!"
18 echo "Deploy scenario: ${DEPLOY_SCENARIO}"
21 # Dev or RPM/ISO build
22 if [[ "$ARTIFACT_VERSION" =~ dev ]]; then
23 # Settings for deploying from git workspace
24 DEPLOY_SETTINGS_DIR="${WORKSPACE}/config/deploy"
25 NETWORK_SETTINGS_DIR="${WORKSPACE}/config/network"
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"
41 DEPLOY_CMD="opnfv-deploy --image-dir ${RESOURCES}"
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 CLEAN_CMD="opnfv-clean"
54 # set to use different directory here because upon RPM removal this
55 # directory will be wiped in daily
56 UPSTREAM_CACHE=$HOME/upstream_cache
57 if [ "$BRANCH" == 'master' ]; then
58 mkdir -p ${UPSTREAM_CACHE}
59 RESOURCES=$UPSTREAM_CACHE
61 RESOURCES="/var/opt/opnfv/images"
63 DEPLOY_CMD="opnfv-deploy --image-dir ${RESOURCES}"
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 # These are add-ons to regular scenarios where you can do like
104 # os-nosdn-nofeature-noha-ipv6, or os-nosdn-nofeature-noha-allinone
105 if echo ${DEPLOY_SCENARIO} | grep ipv6; then
107 DEPLOY_SCENARIO=$(echo ${DEPLOY_SCENARIO} | sed 's/-ipv6//')
108 echo "INFO: IPV6 Enabled"
109 elif echo ${DEPLOY_SCENARIO} | grep allinone; then
111 DEPLOY_SCENARIO=$(echo ${DEPLOY_SCENARIO} | sed 's/-allinone//')
112 echo "INFO: All in one deployment detected"
115 echo "Deploy Scenario set to ${DEPLOY_SCENARIO}"
116 DEPLOY_FILE="${DEPLOY_SETTINGS_DIR}/${DEPLOY_SCENARIO}.yaml"
118 if [ ! -e "$DEPLOY_FILE" ]; then
119 echo "ERROR: Required settings file missing: Deploy settings file ${DEPLOY_FILE}"
122 if [[ "$JOB_NAME" =~ "virtual" ]]; then
123 # settings for virtual deployment
124 DEPLOY_CMD="${DEPLOY_CMD} -v"
125 if [[ "${DEPLOY_SCENARIO}" =~ fdio|ovs ]]; then
126 DEPLOY_CMD="${DEPLOY_CMD} --virtual-default-ram 12 --virtual-compute-ram 7"
128 if [[ "$ALLINONE_FLAG" == "True" ]]; then
129 DEPLOY_CMD="${DEPLOY_CMD} --virtual-computes 0"
130 elif [[ "$PROMOTE" == "True" ]]; then
131 DEPLOY_CMD="${DEPLOY_CMD} --virtual-computes 2"
134 if [[ "$PROMOTE" == "True" ]]; then
135 if [[ "$DEPLOY_SCENARIO" =~ "queens" ]]; then
136 CSIT_ENV="csit-queens-environment.yaml"
138 CSIT_ENV="csit-environment.yaml"
140 DEPLOY_CMD="${DEPLOY_CMD} -e ${CSIT_ENV}"
143 # settings for bare metal deployment
144 NETWORK_SETTINGS_DIR="/root/network"
145 INVENTORY_FILE="/root/inventory/pod_settings.yaml"
147 if ! sudo test -e "$INVENTORY_FILE"; then
148 echo "ERROR: Required settings file missing: Inventory settings file ${INVENTORY_FILE}"
151 # include inventory file for bare metal deployment
152 DEPLOY_CMD="${DEPLOY_CMD} -i ${INVENTORY_FILE}"
155 if [[ "$BRANCH" == "master" ]]; then
156 echo "Upstream deployment detected"
157 DEPLOY_CMD="${DEPLOY_CMD} --upstream"
160 if [ "$IPV6_FLAG" == "True" ]; then
161 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings_v6.yaml"
162 elif [[ "$PROMOTE" == "True" ]]; then
163 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings_csit.yaml"
165 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings.yaml"
168 # Check that network settings file exists
169 if ! sudo test -e "$NETWORK_FILE"; then
170 echo "ERROR: Required settings file missing: Network Settings file ${NETWORK_FILE}"
175 sudo ${DEPLOY_CMD} -d ${DEPLOY_FILE} -n ${NETWORK_FILE} --debug
178 echo "--------------------------------------------------------"