Skip to content

Commit b81d17b

Browse files
committed
MB-67886: Manually fetch pip for cluster_tests
Now that ensurepip isn't bundled with the python we ship couchbase with, cluster_tests can't use it to install requirements. Initially we fixed this with a temporary solution to make use of the python already installed on the Jenkins workers: https://review.couchbase.org/c/ns_server/+/231838 This approach doesn't work on every machine, since not every machine has python with support for venv and pip. Instead we have to manually download pip, and just use that. Change-Id: I7ae64dcb734537ca720be25911c2b6d7c89c56bb Reviewed-on: https://review.couchbase.org/c/ns_server/+/231854 Tested-by: Peter Searby <[email protected]> Well-Formed: Build Bot <[email protected]> Well-Formed: Restriction Checker Reviewed-by: Ben Huddleston <[email protected]>
1 parent 3658fc2 commit b81d17b

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

cluster_tests/CMakeLists.txt

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
1+
SET(GET_PIP_PY_FILE ${CMAKE_CURRENT_BINARY_DIR}/get-pip.py)
12

2-
# Fetch WORKSPACE from ENV for Jenkins
3-
SET(WORKSPACE ${CMAKE_CURRENT_BINARY_DIR})
4-
IF ($ENV{WORKSPACE})
5-
SET(WORKSPACE $ENV{WORKSPACE})
6-
ENDIF ($ENV{WORKSPACE})
7-
# Fetch WORKSPACE from ENV for Jenkins
8-
SET(VIRTUALENV_NAME ns_server_cluster_tests})
9-
IF ($ENV{VIRTUALENV_NAME})
10-
SET(VIRTUALENV_NAME $ENV{VIRTUALENV_NAME})
11-
ENDIF ($ENV{VIRTUALENV_NAME})
3+
# We call this with a cmake call so that we can download the file at build time,
4+
# rather than configure time, which avoids downloading the file needlessly
5+
SET (GET_PIP_CMD "${CMAKE_COMMAND}"
6+
-D "GET_PIP_PY_FILE=${GET_PIP_PY_FILE}"
7+
-P "${CMAKE_CURRENT_SOURCE_DIR}/get_pip.cmake")
128

139
ADD_CUSTOM_TARGET(cluster_tests_python_requirements
14-
COMMAND python -m venv ${WORKSPACE}/${VIRTUALENV_NAME}
15-
COMMAND source ${WORKSPACE}/${VIRTUALENV_NAME}/bin/activate
16-
COMMAND python -m pip install --upgrade pip
17-
COMMAND python -m pip
10+
COMMAND ${GET_PIP_CMD}
11+
COMMAND ${PYTHON_EXE} ${GET_PIP_PY_FILE}
12+
COMMAND ${PYTHON_EXE} -m pip
1813
install -r ${CMAKE_CURRENT_SOURCE_DIR}/requirements.txt)
1914
SEPARATE_ARGUMENTS(cluster_test_args NATIVE_COMMAND $ENV{CLUSTER_TESTS_ARGS})
2015
ADD_CUSTOM_TARGET(cluster_tests
21-
COMMAND source ${WORKSPACE}/${VIRTUALENV_NAME}/bin/activate
22-
COMMAND JAVA_HOME=${Java_JAVA_HOME} python
16+
COMMAND JAVA_HOME=${Java_JAVA_HOME} ${PYTHON_EXE}
2317
${CMAKE_CURRENT_SOURCE_DIR}/run.py ${cluster_test_args}
2418
DEPENDS cluster_tests_python_requirements
2519
COMMAND_EXPAND_LISTS)

cluster_tests/get_pip.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FILE(DOWNLOAD https://bootstrap.pypa.io/get-pip.py
2+
${GET_PIP_PY_FILE} TIMEOUT 60)

0 commit comments

Comments
 (0)