Update setup.sh for new pythontestingutils
[testsuite.git] / setup.sh
1 #!/bin/bash
2 #
3 # setup : script to setup required runtime environment. This script can be run again to update anything
4 # this should stay in your project directory
5
6
7 # save console output in setup_<timestamp>.log file in project directory
8 timestamp=$(date +"%m%d%Y_%H%M%S")
9 LOG_FILE=setup_$timestamp.log
10 exec > >(tee -a ${LOG_FILE} )
11 exec 2> >(tee -a ${LOG_FILE} >&2)
12
13
14 # get the path
15 path=$(pwd)
16 pip install \
17 --no-cache-dir \
18 --exists-action s \
19 --target="$path/robot/library" \
20 'selenium<=3.0.0' \
21 'requests==2.11.1' \
22 'robotframework-selenium2library==1.8.0' \
23 'robotframework-databaselibrary==0.8.1' \
24 'robotframework-extendedselenium2library==0.9.1' \
25 'robotframework-requests==0.5.0' \
26 'robotframework-sshlibrary==2.1.2' \
27 'robotframework-sudslibrary==0.8' \
28 'robotframework-ftplibrary==1.3' \
29 'robotframework-rammbock==0.4.0.1' \
30 'deepdiff==2.5.1' \
31 'dnspython==1.15.0' \
32 'robotframework-httplibrary==0.4.2' \
33 'robotframework-archivelibrary==0.3.2' \
34 'PyYAML==3.12' \
35 'json5==0.7.0' \
36 'robotframework-kafkalibrary==0.0.2'
37
38
39 # get the git for the eteutils you will need to add a private key to your ssh before this
40 if [ -d $path/testsuite/eteutils ]
41 then
42     # Support LF build location
43         cd $path/testsuite/eteutils
44 else
45         cd ~
46         git config --global http.sslVerify false
47         if [ -d ~/python-testing-utils ]
48         then
49                 cd python-testing-utils
50                 git pull origin master
51         else
52                 git clone https://gerrit.onap.org/r/testsuite/python-testing-utils.git
53                 cd python-testing-utils
54         fi
55 fi
56
57 pip install \
58 --no-cache-dir \
59 --upgrade \
60 --exists-action s \
61 --target="$path/robot/library" ./robotframework-onap
62
63
64 if [ -d $path/testsuite/heatbridge ]
65 then
66     # Support LF build location
67         cd $path/testsuite/heatbridge
68 else
69         cd ~
70         git config --global http.sslVerify false
71         if [ -d ~/heatbridge ]
72         then
73                 cd heatbridge
74                 git pull origin master
75         else
76                 git clone https://gerrit.onap.org/r/testsuite/heatbridge.git
77                 cd heatbridge
78         fi
79 fi
80
81 pip install \
82 --no-cache-dir \
83 --upgrade \
84 --exists-action s \
85 --target="$path/robot/library" \
86 ./heatbridge
87
88
89 # NOTE: Patch to incude explicit install of paramiko to 2.0.2 to work with sshlibrary 2.1.2
90 # This should be removed on new release of paramiko (2.1.2) or sshlibrary
91 # https://github.com/robotframework/SSHLibrary/issues/157
92 pip install \
93 --no-cache-dir \
94 --target="$path/robot/library" \
95 -U 'paramiko==2.0.2'
96
97
98 # Go back to execution folder
99 cd $path
100
101 # if the script is running during the image build skip the rest of it
102 # as required software is installed already.
103 if $BUILDTIME
104 then
105         # we need to update PATH with chromium-chromedriver
106         echo "Adding in-container chromedriver to PATH"
107         ln -s /usr/lib/chromium-browser/chromedriver /usr/local/bin/chromedriver
108         
109         echo "Skipping desktop steps, building container image..."
110 else    
111         #
112         # Get the appropriate chromedriver. Default to linux64
113         #
114         CHROMEDRIVER_URL=http://chromedriver.storage.googleapis.com/2.43
115         CHROMEDRIVER_ZIP=chromedriver_linux64.zip
116         CHROMEDRIVER_TARGET=chromedriver.zip
117
118         # Handle mac and windows
119         OS=`uname -s`
120         case $OS in
121           MINGW*_NT*)
122                 CHROMEDRIVER_ZIP=chromedriver_win32.zip
123                 ;;
124           Darwin*)
125                 CHROMEDRIVER_ZIP=chromedriver_mac64.zip
126                 ;;
127           *) echo "Defaulting to Linux 64" ;;
128         esac
129
130         if [ $CHROMEDRIVER_ZIP == 'chromedriver_linux64.zip' ]
131         then
132             curl $CHROMEDRIVER_URL/$CHROMEDRIVER_ZIP -o $CHROMEDRIVER_TARGET
133                 unzip chromedriver.zip -d /usr/local/bin
134         else
135             curl $CHROMEDRIVER_URL/$CHROMEDRIVER_ZIP -o $CHROMEDRIVER_TARGET
136                 unzip $CHROMEDRIVER_TARGET
137         fi
138         rm -rf $CHROMEDRIVER_TARGET
139 fi
140
141 #
142 # Install kafkacat : https://github.com/edenhill/kafkacat
143 #
144 OS=`uname -s`
145 case $OS in
146         Darwin)
147                 brew install kafkacat ;;
148         Linux)
149                 apt-get -y install kafkacat
150 esac
151 #
152 # Install protobuf
153 #
154 OS=`uname -s`
155 case $OS in
156         Darwin)
157                 brew install protobuf ;;
158         Linux)
159                 apt-get -y install protobuf-compiler
160 esac