2281d235cb6c34df5643aba5ef0b6133e77591b7
[policy/docker.git] / csit / resources / scripts / prepare-robot-env.sh
1 #!/bin/bash -x
2 #
3 # Copyright 2019 © Samsung Electronics Co., Ltd.
4 # Modification Copyright 2021 © AT&T Intellectual Property.
5 # Modification Copyright 2021-2023 Nordix Foundation.
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #     http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19 # This script installs common libraries required by CSIT tests
20 #
21
22 if [ -z "$WORKSPACE" ]; then
23     WORKSPACE=$(git rev-parse --show-toplevel)
24     export WORKSPACE
25 fi
26
27 ROBOT_VENV=$(mktemp -d)
28 echo "ROBOT_VENV=${ROBOT_VENV}" >> "${WORKSPACE}/env.properties"
29
30 echo "Python version is: $(python3 --version)"
31
32 python3 -m venv --clear "${ROBOT_VENV}"
33 source "${ROBOT_VENV}/bin/activate" > /dev/null
34
35 set -exu
36
37 python3 -m pip install -qq --upgrade "pip<=23.0" "setuptools<=66.1.1"
38 echo "Installing Python Requirements"
39 python3 -m pip install -qq -r "${SCRIPTS}"/pylibs.txt
40 python3 -m pip -qq freeze
41
42 # install eteutils
43 mkdir -p "${ROBOT_VENV}"/src/onap
44 rm -rf "${ROBOT_VENV}"/src/onap/testsuite
45 python3 -m pip install -qq --upgrade --extra-index-url="https://nexus3.onap.org/repository/PyPi.staging/simple" 'robotframework-onap==0.6.0.*' --pre
46
47 echo "Uninstall docker-py and reinstall docker."
48 python3 -m pip uninstall -y -qq docker
49 python3 -m pip install -U -qq docker
50
51 python3 -m pip -qq freeze
52
53 if (uname | grep -q 'Linux')
54 then
55     sudo apt-get -y -qq install libxml2-utils
56 fi