#!/bin/bash ### Some other ways to get build_node_ip in case you don't want to make a file on Jenkins server ### #build_node_ip=$(openstack server list -c Name -c Networks -f value | egrep ${stack_name} | awk '{print $NF}') #build_node_ip=$(openstack server show ${stack_name} -f value -c addresses | cut -d' ' -f2 ) ### Setting variables used in this script ### build_node_ip=$(openstack server list -c Name -c Networks -f value | egrep ${openstack_build_stack_name} | awk '{print $NF}' | sed 's/.*=//g') ssh_cmd="ssh -o StrictHostKeychecking=no -i ${ssh_key} ${remote_user}@${build_node_ip}" docker_repo="https://download.docker.com/linux/centos/docker-ce.repo" #################################### ### PREPARATIONS FOR CENTOS ONLY ### #################################### ### Required by special centos docker recommended by ONAP ### RESULT=$(${ssh_cmd} "sudo yum-config-manager --add-repo ${docker_repo}") if [[ $? -ne 0 ]]; then echo "Failed to install add repo successfully: $RESULT" exit -1 fi ### Enable epel repo for npm and jq ### RESULT=$(${ssh_cmd} "sudo yum install -y epel-release") if [[ $? -ne 0 ]]; then echo "Failed to install epel-release successfully: $RESULT" exit -1 fi ### Install following packages ### RESULT=$(${ssh_cmd} "sudo yum install -y docker-ce-18.09.5 python-pip git createrepo expect nodejs npm jq") if [[ $? -ne 0 ]]; then echo "Failed to install packages successfully: $RESULT" exit -1 fi ### Offline Installer is using python3 now, thus need to install python3 and pip3 ### RESULT=$(${ssh_cmd} "sudo yum install -y python36 python36-pip") if [[ $? -ne 0 ]]; then echo "Failed to install packages: $RESULT" exit -1 fi ### Install Twine, specific version 1.15.0 used, because new version 2.0.0 breaks the installation ### RESULT=$(${ssh_cmd} "sudo pip install twine==1.15.0") if [[ $? -ne 0 ]]; then echo "Failed to pip install twine: $RESULT" exit -1 fi ### Starting Docker Service ### RESULT=$(${ssh_cmd} "sudo service docker start") if [[ $? -ne 0 ]]; then echo "Failed to pip install twine: $RESULT" exit -1 fi ### Clone the OFfline Installer repo ### RESULT=$(${ssh_cmd} " sudo git clone https://gerrit.onap.org/r/oom/offline-installer /tmp/onap-offline") if [[ $? -ne 0 ]]; then echo "Failed to clone onap/offline/install repo: $RESULT" exit -1 fi sleep 5 ### Install the required python packages ### RESULT=$(${ssh_cmd} "sudo pip3 install -r /tmp/onap-offline/build/requirements.txt") if [[ $? -ne 0 ]]; then echo "Failed to install: $RESULT" exit -1 fi RESULT=$(${ssh_cmd} "sudo pip3 install -r /tmp/onap-offline/build/download/requirements.txt") if [[ $? -ne 0 ]]; then echo "Failed to install: $RESULT" exit -1 fi