add ccsdk-sli-northbound
[infra/cicd.git] / jjb / onap-offline / build_jobs / scripts / 4_build_nexus.sh
1 #!/bin/bash
2
3 ### Setting up variables used in the script ###
4 build_node_ip=$(openstack server list -c Name -c Networks -f value | egrep ${openstack_build_stack_name} | awk '{print $NF}' | sed 's/.*=//g')
5 ssh_cmd="ssh -o StrictHostKeychecking=no -i ${ssh_key} ${remote_user}@${build_node_ip}"
6
7 ### Concat'ing the onap and rke images lists ###
8 RESULT=$(${ssh_cmd} "sudo bash -c \"cat ${data_list_dir}/rke_docker_images.list >> ${data_list_dir}/onap_docker_images.list\"")
9 if [[ $? -ne 0 ]]; then
10   echo "Failed to concat the lists: ${RESULT}"
11   exit -1
12 fi
13
14 ### Building the nexus blob ###
15 RESULT=$(${ssh_cmd} "sudo ${build_dir}/build_nexus_blob.sh")
16 if [[ $? -ne 0 ]]; then
17   echo "Failed to build nexus blob: ${RESULT}"
18   exit -1
19 fi
20
21 ### Deleting docker images and npm files in order to free up space on the server ###
22 RESULT=$(${ssh_cmd} "sudo rm -f ${resources_dir}/offline_data/docker_images_for_nexus/*")
23 if [[ $? -ne 0 ]]; then
24   echo "Failed to cleanup nexus docker images: ${RESULT}"
25   exit -1
26 fi
27
28 RESULT=$(${ssh_cmd} "sudo rm -rf ${resources_dir}/offline_data/npm_tar")
29 if [[ $? -ne 0 ]]; then
30   echo "Failed to cleanup npm directory: ${RESULT}"
31   exit -1
32 fi