asledzinskiy | 69307da | 2017-01-19 16:37:16 +0200 | [diff] [blame] | 1 | package com.mirantis.mcp_qa |
asledzinskiy | e0948fd | 2017-01-06 16:23:54 +0200 | [diff] [blame] | 2 | |
| 3 | /** |
| 4 | * Activate virtual environment and check k8s deployer is specified |
| 5 | */ |
| 6 | |
| 7 | def prepareEnv() { |
| 8 | sh ''' |
| 9 | if [ ! -r "${VENV_PATH}/bin/activate" ]; then |
| 10 | echo 'Python virtual environment not found! Set correct VENV_PATH!' |
| 11 | exit 1 |
| 12 | fi |
| 13 | ''' |
| 14 | |
| 15 | sh ''' |
| 16 | if [ ! -r "${WORKSPACE}/fuel-ccp-installer/${DEPLOY_SCRIPT_REL_PATH}" ]; then |
| 17 | echo "Deploy script \"${DEPLOY_SCRIPT_REL_PATH}\" not found in" \ |
| 18 | "\"${WORKSPACE}/fuel-ccp-installer/\"!" |
| 19 | fi |
| 20 | ''' |
asledzinskiy | 85ae52b | 2017-02-02 17:59:20 +0200 | [diff] [blame] | 21 | |
| 22 | sh ''' |
| 23 | . ${VENV_PATH}/bin/activate |
| 24 | pip install --upgrade --upgrade-strategy=only-if-needed -r fuel_ccp_tests/requirements.txt |
| 25 | ''' |
asledzinskiy | e0948fd | 2017-01-06 16:23:54 +0200 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | /** |
| 29 | * Destroy running environment |
| 30 | */ |
| 31 | |
| 32 | def destroyEnv() { |
| 33 | if ( !(env.KEEP_BEFORE.equals('yes') || env.KEEP_BEFORE.equals('true')) ) { |
| 34 | sh ''' |
| 35 | . ${VENV_PATH}/bin/activate |
| 36 | dos.py destroy ${ENV_NAME} || true |
| 37 | ''' |
| 38 | } |
| 39 | } |
asledzinskiy | c4cd5b7 | 2017-01-25 16:50:56 +0200 | [diff] [blame] | 40 | |
| 41 | /** |
| 42 | * Erase running environment |
| 43 | */ |
| 44 | def eraseEnv() { |
| 45 | sh ''' |
| 46 | . ${VENV_PATH}/bin/activate |
| 47 | dos.py erase ${ENV_NAME} || true |
| 48 | ''' |
| 49 | } |
| 50 | |