blob: bc88d64782371820eb31338e9081bae3ad68b2ce [file] [log] [blame]
asledzinskiy69307da2017-01-19 16:37:16 +02001package com.mirantis.mcp_qa
asledzinskiye0948fd2017-01-06 16:23:54 +02002
3/**
4 * Activate virtual environment and check k8s deployer is specified
5 */
6
7def 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 '''
asledzinskiy85ae52b2017-02-02 17:59:20 +020021
22 sh '''
23 . ${VENV_PATH}/bin/activate
24 pip install --upgrade --upgrade-strategy=only-if-needed -r fuel_ccp_tests/requirements.txt
25 '''
asledzinskiye0948fd2017-01-06 16:23:54 +020026}
27
28/**
29 * Destroy running environment
30 */
31
32def 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}
asledzinskiyc4cd5b72017-01-25 16:50:56 +020040
41/**
42 * Erase running environment
43 */
44def eraseEnv() {
45 sh '''
46 . ${VENV_PATH}/bin/activate
47 dos.py erase ${ENV_NAME} || true
48 '''
49}
50