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