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