[SDC-29] rebase continue work to align source
[sdc.git] / ui-ci / src / main / resources / ci / scripts / copyToStorage.sh
1 #!/bin/bash
2
3 REPORT_NAME=$1
4 VERSION=$2
5 ENV=$3
6 IP=$3
7
8 if [ -z "$REPORT_NAME" ]
9  then
10         source ExtentReport/versions.info
11         now=$(date +'%Y-%m-%d_%H_%M')
12         REPORT_NAME="${now}"
13         VERSION="${osVersion}"
14                 if [[ $env == *"DEV20"* ]]
15                         then
16                                 ENV="Nightly"
17                         else
18                                 ENV=""
19                         fi      
20
21  fi
22
23 /usr/bin/expect  << EOF
24 spawn ssh admin@${IP} mkdir -p -m 775 /home/admin/reports/${ENV}/${VERSION}/UI/
25
26 expect {
27   -re ".*es.*o.*" {
28     exp_send "yes\r"
29     exp_continue
30   }
31   -re ".*sword.*" {
32     exp_send "Aa123456\r"
33   }
34 }
35
36 expect eof
37
38 spawn scp -pr ExtentReport admin@{IP}:/home/admin/reports/${ENV}/${VERSION}/UI/${REPORT_NAME}/
39
40 expect {
41   -re ".*es.*o.*" {
42     exp_send "yes\r"
43     exp_continue
44   }
45   -re ".*sword.*" {
46     exp_send "Aa123456\r"
47   }
48 }
49
50 expect eof
51 EOF