[SDC-29] rebase continue work to align source
[sdc.git] / test-apis-ci / src / main / resources / ci / scripts / copyToStorage.sh
1 #!/bin/bash
2
3 REPORT_NAME=$1
4 VERSION=$2
5 ENV=$3
6 IP=$4
7
8 if [ -z "$REPORT_NAME" ]
9  then
10         source ExtentReport/versions.info
11         now=$(date -d '+7 hour' "+%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}/APIs/
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 -r ExtentReport admin@${IP}:/home/admin/reports/${ENV}/${VERSION}/APIs/${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
52 spawn ssh admin@${IP} chmod -R 775 /home/admin/reports/${ENV}/${VERSION}/APIs/${REPORT_NAME}/
53
54 expect {
55   -re ".*es.*o.*" {
56     exp_send "yes\r"
57     exp_continue
58   }
59   -re ".*sword.*" {
60     exp_send "Aa123456\r"
61   }
62 }
63
64 expect eof
65
66 EOF