3 # Copyright 2019-2021 Samsung Electronics Co., Ltd.
4 # Modifications Copyright (C) 2021 Pantheon.tech
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 # This script installs common libraries required by CSIT tests
21 echo "---> prepare-csit.sh"
25 ROBOT_INSTALLER='include-raw-integration-install-robotframework-py3.sh'
27 if !(which git > /dev/null 2>&1); then
28 echo "GIT binary not found current PATH"
32 if [ -z "$WORKSPACE" ]; then
33 # shellcheck disable=SC2155
34 export WORKSPACE=`git rev-parse --show-toplevel`
37 # shellcheck disable=SC2034
38 TESTPLANDIR=${WORKSPACE}/${TESTPLAN}
40 # Python version should match that used to setup
41 # robot-framework in other jobs/stages
42 # Use pyenv for selecting the python version
43 if [[ -d "/opt/pyenv" ]]; then
45 export PYENV_ROOT="/opt/pyenv"
46 export PATH="$PYENV_ROOT/bin:$PATH"
48 if command -v pyenv 1>/dev/null 2>&1; then
49 eval "$(pyenv init - --no-rehash)"
50 # Choose the latest numeric Python version from installed list
51 version=$(pyenv versions --bare | sed '/^[^0-9]/d' \
52 | sort -V | tail -n 1)
53 pyenv local "${version}"
57 # Assume that if ROBOT3_VENV is set, virtualenv
58 # with system site packages can be activated
59 if [ -f ${WORKSPACE}/env.properties ]; then
60 source ${WORKSPACE}/env.properties
62 if [ -f ${ROBOT3_VENV}/bin/activate ]; then
63 source ${ROBOT3_VENV}/bin/activate
65 # Robot framework was not found
66 # clone ci-management repository and use install script
67 git clone "https://gerrit.onap.org/r/ci-management" \
69 source /tmp/ci-management/jjb/integration/${ROBOT_INSTALLER}
73 mkdir -p ${ROBOT3_VENV}/src/onap
74 rm -rf ${ROBOT3_VENV}/src/onap/testsuite
75 # Source from the Nexus repository
76 python3 -m pip install --upgrade \
77 --extra-index-url="https://nexus3.onap.org/repository/PyPi.staging/simple" \
78 'robotframework-onap==11.0.0.dev17' \
81 echo "Versioning information:"
84 python3 -m robot.run --version || :