11 echo "Starting the Apex deployment."
12 echo "--------------------------------------------------------"
15 if [ -z "$DEPLOY_SCENARIO" ]; then
16 echo "Deploy scenario not set!"
19 echo "Deploy scenario: ${DEPLOY_SCENARIO}"
22 # Dev or RPM/ISO build
23 if [[ "$ARTIFACT_VERSION" =~ dev ]]; then
24 # Settings for deploying from git workspace
25 DEPLOY_SETTINGS_DIR="${WORKSPACE}/config/deploy"
26 NETWORK_SETTINGS_DIR="${WORKSPACE}/config/network"
27 CLEAN_CMD="opnfv-clean"
28 # if we are using master, then we are downloading/caching upstream images
29 # we want to use that built in mechanism to avoid re-downloading every job
30 # so we use a dedicated folder to hold the upstream cache
31 UPSTREAM_CACHE=$HOME/upstream_cache
32 if [ "$BRANCH" == 'master' ]; then
33 mkdir -p ${UPSTREAM_CACHE}
34 RESOURCES=$UPSTREAM_CACHE
36 RESOURCES="${WORKSPACE}/.build/"
38 CONFIG="${WORKSPACE}/build"
41 LIB="${WORKSPACE}/lib"
42 DEPLOY_CMD="opnfv-deploy --image-dir ${RESOURCES}"
43 # Ensure artifacts were downloaded and extracted correctly
44 # TODO(trozet) add verification here
47 sudo rm -rf /tmp/.build
49 sudo pip3 install --upgrade --force-reinstall .
50 mv -f /tmp/.build ${WORKSPACE}/
52 DEPLOY_SETTINGS_DIR="/etc/opnfv-apex/"
53 NETWORK_SETTINGS_DIR="/etc/opnfv-apex/"
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 DEPLOY_CMD="opnfv-deploy --image-dir ${RESOURCES}"
65 CONFIG="/var/opt/opnfv"
68 LIB="/var/opt/opnfv/lib"
69 sudo mkdir -p /var/log/apex
70 sudo chmod 777 /var/log/apex
74 # Install Dependencies
75 # Make sure python34 dependencies are installed
76 dependencies="epel-release python34 python34-devel libvirt-devel python34-pip \
77 ansible python34-PyYAML python34-jinja2 python34-setuptools python-tox ansible"
79 for dep_pkg in $dependencies; do
80 if ! rpm -q ${dep_pkg} > /dev/null; then
81 if ! sudo yum install -y ${dep_pkg}; then
82 echo "Failed to install ${dep_pkg}"
88 if [[ "$JOB_NAME" =~ "virtual" ]]; then
89 # Make sure ipxe-roms-qemu package is updated to latest.
90 # This package is needed for multi virtio nic PXE boot in virtual environment.
91 sudo yum update -y ipxe-roms-qemu
94 if [ "$OPNFV_CLEAN" == 'yes' ]; then
95 if sudo test -e '/root/inventory/pod_settings.yaml'; then
96 clean_opts='-i /root/inventory/pod_settings.yaml'
101 sudo ${CLEAN_CMD} ${clean_opts}
104 # These are add-ons to regular scenarios where you can do like
105 # os-nosdn-nofeature-noha-ipv6, or os-nosdn-nofeature-noha-allinone
106 if echo ${DEPLOY_SCENARIO} | grep ipv6; then
108 DEPLOY_SCENARIO=$(echo ${DEPLOY_SCENARIO} | sed 's/-ipv6//')
109 echo "INFO: IPV6 Enabled"
112 if echo ${DEPLOY_SCENARIO} | grep allinone; then
114 DEPLOY_SCENARIO=$(echo ${DEPLOY_SCENARIO} | sed 's/-allinone//')
115 echo "INFO: All in one deployment detected"
118 if echo ${DEPLOY_SCENARIO} | grep csit; then
120 DEPLOY_SCENARIO=$(echo ${DEPLOY_SCENARIO} | sed 's/-csit//')
121 echo "INFO: CSIT env requested in deploy scenario"
124 echo "Deploy Scenario set to ${DEPLOY_SCENARIO}"
125 DEPLOY_FILE="${DEPLOY_SETTINGS_DIR}/${DEPLOY_SCENARIO}.yaml"
127 if [ ! -e "$DEPLOY_FILE" ]; then
128 echo "ERROR: Required settings file missing: Deploy settings file ${DEPLOY_FILE}"
131 if [[ "$JOB_NAME" =~ "virtual" ]]; then
132 # settings for virtual deployment
133 DEPLOY_CMD="${DEPLOY_CMD} -v"
134 if [[ "${DEPLOY_SCENARIO}" =~ fdio|ovs ]]; then
135 DEPLOY_CMD="${DEPLOY_CMD} --virtual-default-ram 12 --virtual-compute-ram 7"
137 if [[ "$ALLINONE_FLAG" == "True" ]]; then
138 DEPLOY_CMD="${DEPLOY_CMD} --virtual-computes 0"
139 elif [[ "$PROMOTE" == "True" ]]; then
140 DEPLOY_CMD="${DEPLOY_CMD} --virtual-computes 2"
143 if [[ "$PROMOTE" == "True" || "$CSIT_ENV_FLAG" == "True" ]]; then
144 if [[ "$DEPLOY_SCENARIO" =~ "queens" ]]; then
145 CSIT_ENV="csit-queens-environment.yaml"
147 CSIT_ENV="csit-environment.yaml"
149 DEPLOY_CMD="${DEPLOY_CMD} -e ${CSIT_ENV}"
152 # settings for bare metal deployment
153 NETWORK_SETTINGS_DIR="/root/network"
154 INVENTORY_FILE="/root/inventory/pod_settings.yaml"
156 if ! sudo test -e "$INVENTORY_FILE"; then
157 echo "ERROR: Required settings file missing: Inventory settings file ${INVENTORY_FILE}"
160 # include inventory file for bare metal deployment
161 DEPLOY_CMD="${DEPLOY_CMD} -i ${INVENTORY_FILE}"
164 if [[ "$BRANCH" == "master" ]]; then
165 echo "Upstream deployment detected"
166 DEPLOY_CMD="${DEPLOY_CMD} --upstream"
169 if [ "$IPV6_FLAG" == "True" ]; then
170 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings_v6.yaml"
171 elif [[ "$PROMOTE" == "True" ]]; then
172 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings_csit.yaml"
174 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings.yaml"
177 # Check that network settings file exists
178 if ! sudo test -e "$NETWORK_FILE"; then
179 echo "ERROR: Required settings file missing: Network Settings file ${NETWORK_FILE}"
184 sudo ${DEPLOY_CMD} -d ${DEPLOY_FILE} -n ${NETWORK_FILE} --debug
187 echo "--------------------------------------------------------"