add ccsdk-sli-northbound
[infra/cicd.git] / jjb / onap-offline / build_jobs / scripts / 5_build_create_package.sh
1 #!/bin/bash
2
3 ### Setting up variables used in this 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 ### Tarring up the files refer to package_oom_cmd for oom version used ###
8 RESULT=$(${ssh_cmd} "${package_oom_cmd} --output-dir /tmp/data --resources-directory ${resources_dir}")
9 if [[ $? -ne 0 ]]; then
10   ### /tmp/data might be already used, thus clean it up and restart again ###
11   ${ssh_cmd} "sudo bash -c \"rm -rf /tmp/data\""
12   ${ssh_cmd} "${package_oom_cmd} --output-dir /tmp/data --resources-directory ${resources_dir}"
13   if [[ $? -ne 0 ]]; then
14   echo "failed to successfully run package.py"
15   exit -1
16   fi
17 fi
18
19 ### Since the values.yaml has pnda set to false (due to issues with the website) the package created contains a different name than used usually ###
20 ### Need to change the name of the tar files ###
21
22 ${ssh_cmd} "sudo bash -c \"test -f /tmp/data/resources_packagecustom.tar\""
23 if [[ $? -eq 0 ]]; then
24   echo "There is a custom package";
25   ${ssh_cmd} "sudo bash -c \"mv /tmp/data/resources_packagecustom.tar /tmp/data/resources_package.tar\"";
26 fi
27
28 ${ssh_cmd} "sudo bash -c \"test -f /tmp/data/sw_packagecustom.tar\""
29 if [[ $? -eq 0 ]]; then
30   echo "There is a custom package";
31   ${ssh_cmd} "sudo bash -c \"mv /tmp/data/sw_packagecustom.tar /tmp/data/sw_package.tar\"";
32 fi