blob: 1052bff8687412a131e2ca0a4d2f3f17e4849692 [file] [log] [blame]
Matthew Watkins8850db12022-12-16 18:01:56 +00001#!/bin/bash -x
2#
3# Copyright 2019-2021 Samsung Electronics Co., Ltd.
4# Modifications Copyright (C) 2021 Pantheon.tech
5#
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
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
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.
17#
18# This script installs common libraries required by CSIT tests
19#
20
21echo "---> prepare-csit.sh"
22
23set -exo pipefail
24
25ROBOT_INSTALLER='include-raw-integration-install-robotframework-py3.sh'
26
27if !(which git > /dev/null 2>&1); then
28 echo "GIT binary not found current PATH"
29 echo $PATH; exit 1
30fi
31
32if [ -z "$WORKSPACE" ]; then
33 # shellcheck disable=SC2155
34 export WORKSPACE=`git rev-parse --show-toplevel`
35fi
36
37# shellcheck disable=SC2034
38TESTPLANDIR=${WORKSPACE}/${TESTPLAN}
39
40# Python version should match that used to setup
41# robot-framework in other jobs/stages
42# Use pyenv for selecting the python version
43if [[ -d "/opt/pyenv" ]]; then
44 echo "Setup pyenv:"
45 export PYENV_ROOT="/opt/pyenv"
46 export PATH="$PYENV_ROOT/bin:$PATH"
47 pyenv versions
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}"
54 fi
55fi
56
57# Assume that if ROBOT3_VENV is set, virtualenv
58# with system site packages can be activated
59if [ -f ${WORKSPACE}/env.properties ]; then
60 source ${WORKSPACE}/env.properties
61fi
62if [ -f ${ROBOT3_VENV}/bin/activate ]; then
63 source ${ROBOT3_VENV}/bin/activate
64else
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" \
68 /tmp/ci-management
69 source /tmp/ci-management/jjb/integration/${ROBOT_INSTALLER}
70fi
71
72# install eteutils
73mkdir -p ${ROBOT3_VENV}/src/onap
74rm -rf ${ROBOT3_VENV}/src/onap/testsuite
75# Source from the Nexus repository
76python3 -m pip install --upgrade \
77 --extra-index-url="https://nexus3.onap.org/repository/PyPi.staging/simple" \
78 'robotframework-onap==11.0.0.dev17' \
79 --pre
80
81echo "Versioning information:"
82python3 --version
83pip freeze
84python3 -m robot.run --version || :
85