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 [[ "$PROMOTE" == "True" ]]; then
122 if [[ "$JOB_NAME" =~ "queens" ]]; then
123 CSIT_ENV="csit-queens-environment.yaml"
125 CSIT_ENV="csit-environment.yaml"
127 DEPLOY_CMD="${DEPLOY_CMD} --virtual-computes 2 -e ${CSIT_ENV}"
130 # settings for bare metal deployment
131 NETWORK_SETTINGS_DIR="/root/network"
132 INVENTORY_FILE="/root/inventory/pod_settings.yaml"
134 if ! sudo test -e "$INVENTORY_FILE"; then
135 echo "ERROR: Required settings file missing: Inventory settings file ${INVENTORY_FILE}"
138 # include inventory file for bare metal deployment
139 DEPLOY_CMD="${DEPLOY_CMD} -i ${INVENTORY_FILE}"
142 if [[ "$BRANCH" == "master" ]]; then
143 echo "Upstream deployment detected"
144 DEPLOY_CMD="${DEPLOY_CMD} --upstream"
147 if [ "$IPV6_FLAG" == "True" ]; then
148 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings_v6.yaml"
149 elif [[ "$PROMOTE" == "True" ]]; then
150 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings_csit.yaml"
152 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings.yaml"
155 # Check that network settings file exists
156 if ! sudo test -e "$NETWORK_FILE"; then
157 echo "ERROR: Required settings file missing: Network Settings file ${NETWORK_FILE}"
162 sudo ${DEPLOY_CMD} -d ${DEPLOY_FILE} -n ${NETWORK_FILE} --debug
165 echo "--------------------------------------------------------"