diff --git a/.build/build-resolver.xml b/.build/build-resolver.xml index 09263d42aa6e..8eb678c3986d 100644 --- a/.build/build-resolver.xml +++ b/.build/build-resolver.xml @@ -247,6 +247,7 @@ + @@ -284,6 +285,7 @@ + diff --git a/.build/docker/run-tests.sh b/.build/docker/run-tests.sh index ffade4adc8cc..965b192194ee 100755 --- a/.build/docker/run-tests.sh +++ b/.build/docker/run-tests.sh @@ -134,7 +134,7 @@ docker --version pushd ${cassandra_dir}/.build >/dev/null # build test image -dockerfile="ubuntu2004_test.docker" +dockerfile="ubuntu-test.docker" image_tag="$(md5sum docker/${dockerfile} | cut -d' ' -f1)" image_name="apache/cassandra-${dockerfile/.docker/}:${image_tag}" docker_mounts="-v ${cassandra_dir}:/home/cassandra/cassandra -v "${build_dir}":/home/cassandra/cassandra/build -v ${m2_dir}:/home/cassandra/.m2/repository" diff --git a/.build/docker/ubuntu2004_test.docker b/.build/docker/ubuntu-test.docker similarity index 75% rename from .build/docker/ubuntu2004_test.docker rename to .build/docker/ubuntu-test.docker index 9d19baef18b6..dc578a3fe7c6 100644 --- a/.build/docker/ubuntu2004_test.docker +++ b/.build/docker/ubuntu-test.docker @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM ubuntu:20.04 +FROM ubuntu:22.04 MAINTAINER Apache Cassandra # CONTEXT is expected to be cassandra/.build @@ -23,7 +23,7 @@ ENV LC_CTYPE=en_US.UTF-8 ENV PYTHONIOENCODING=utf-8 ENV PYTHONUNBUFFERED=true -LABEL org.cassandra.buildenv=ubuntu_2004 +LABEL org.cassandra.buildenv=ubuntu_2204 RUN echo "Building with arguments:" \ && echo " - DIST_DIR=${DIST_DIR}" \ @@ -42,21 +42,27 @@ RUN echo 'Acquire::ftp::Timeout "60";' >> /etc/apt/apt.conf.d/80proxy.conf RUN export DEBIAN_FRONTEND=noninteractive && \ apt-get update && \ - apt-get install -y --no-install-recommends software-properties-common apt-utils + apt-get install -y --no-install-recommends software-properties-common apt-utils gnupg RUN export DEBIAN_FRONTEND=noninteractive && \ add-apt-repository -y ppa:deadsnakes/ppa && \ apt-get update && \ apt-get install -y curl git-core python3-pip \ python3.8 python3.8-venv python3.8-dev \ + python3.10 python3.10-venv python3.10-dev \ python3.11 python3.11-venv python3.11-dev \ + python3.12 python3.12-venv python3.12-dev \ + python3.13 python3.13-venv python3.13-dev \ virtualenv net-tools libev4 libev-dev wget gcc libxml2 libxslt1-dev \ vim lsof sudo libjemalloc2 dumb-init locales rsync \ openjdk-8-jdk openjdk-11-jdk openjdk-17-jdk ant ant-optional -RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 2 +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 2 RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.11 3 +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.12 4 +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.13 5 RUN python3.8 -m pip install --upgrade pip # generate locales for the standard en_US.UTF8 value we use for testing @@ -93,7 +99,7 @@ WORKDIR ${BUILD_HOME} ENV ANT_HOME=/usr/share/ant # run pip commands and setup virtualenv (note we do this after we switch to cassandra user so we -# setup the virtualenv for the cassandra user and not the root user by accident) for Python 3.8/3.11 +# setup the virtualenv for the cassandra user, not root) for Python 3.8-3.13 # Don't build cython extensions when installing cassandra-driver. During test execution the driver # dependency is refreshed via pip install --upgrade, so that driver changes can be pulled in without # requiring the image to be rebuilt. Rebuilding compiled extensions is costly and is disabled by @@ -110,13 +116,46 @@ RUN /bin/bash -c "export CASS_DRIVER_NO_CYTHON=1 CASS_DRIVER_NO_EXTENSIONS=1 \ && pip3 install -r /opt/requirements.txt \ && pip3 freeze --user" +RUN virtualenv --python=python3.10 ${BUILD_HOME}/env3.10 +RUN chmod +x ${BUILD_HOME}/env3.10/bin/activate + +RUN /bin/bash -c "export CASS_DRIVER_NO_CYTHON=1 CASS_DRIVER_NO_EXTENSIONS=1 \ + && source ${BUILD_HOME}/env3.10/bin/activate \ + && curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10 \ + && pip3 install --upgrade \"pip<25.0\" \"setuptools==60.8.2\" wheel \ + && pip3 install --no-build-isolation -r /opt/requirements.txt \ + && pip3 freeze --user" + RUN virtualenv --python=python3.11 ${BUILD_HOME}/env3.11 RUN chmod +x ${BUILD_HOME}/env3.11/bin/activate RUN /bin/bash -c "export CASS_DRIVER_NO_CYTHON=1 CASS_DRIVER_NO_EXTENSIONS=1 \ && source ${BUILD_HOME}/env3.11/bin/activate \ && curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11 \ - && pip3 install -r /opt/requirements.txt \ + && pip3 install --upgrade \"pip<25.0\" \"setuptools==60.8.2\" wheel \ + && pip3 install --no-build-isolation -r /opt/requirements.txt \ + && pip3 freeze --user" + +RUN virtualenv --python=python3.12 ${BUILD_HOME}/env3.12 +RUN chmod +x ${BUILD_HOME}/env3.12/bin/activate + +RUN /bin/bash -c "export CASS_DRIVER_NO_CYTHON=1 CASS_DRIVER_NO_EXTENSIONS=1 \ + && source ${BUILD_HOME}/env3.12/bin/activate \ + && curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12 \ + && pip3 install --upgrade \"pip<25.0\" \"setuptools>=65.5.0,<70.0.0\" wheel \ + && sed -i 's/pkgutil.ImpImporter/type(\"ImpImporter\", (object,), {})/g' ${BUILD_HOME}/env3.12/lib/python3.12/site-packages/pkg_resources/__init__.py \ + && pip3 install --no-build-isolation -r /opt/requirements.txt \ + && pip3 freeze --user" + +RUN virtualenv --python=python3.13 ${BUILD_HOME}/env3.13 +RUN chmod +x ${BUILD_HOME}/env3.13/bin/activate + +RUN /bin/bash -c "export CASS_DRIVER_NO_CYTHON=1 CASS_DRIVER_NO_EXTENSIONS=1 \ + && source ${BUILD_HOME}/env3.13/bin/activate \ + && curl -sS https://bootstrap.pypa.io/get-pip.py | python3.13 \ + && pip3 install --upgrade \"pip<25.0\" \"setuptools>=65.5.0,<70.0.0\" wheel \ + && sed -i 's/pkgutil.ImpImporter/type(\"ImpImporter\", (object,), {})/g' ${BUILD_HOME}/env3.13/lib/python3.13/site-packages/pkg_resources/__init__.py \ + && pip3 install --no-build-isolation -r /opt/requirements.txt \ && pip3 freeze --user" # Initialize the CCM git repo as well as this also can fail to clone diff --git a/.build/run-python-dtests.sh b/.build/run-python-dtests.sh index f57f69668a57..8af989d7b4d6 100755 --- a/.build/run-python-dtests.sh +++ b/.build/run-python-dtests.sh @@ -138,7 +138,7 @@ set -e # enable immediate exit if venv setup fails # fresh virtualenv and test logs results everytime [[ "/" == "${DIST_DIR}" ]] || rm -rf "${DIST_DIR}/venv" "${DIST_DIR}/test/{html,output,logs}" -# re-use when possible the pre-installed virtualenv found in the cassandra-ubuntu2004_test docker image +# re-use when possible the pre-installed virtualenv found in the cassandra-ubuntu-test docker image virtualenv-clone ${BUILD_HOME}/env${python_version} ${DIST_DIR}/venv || virtualenv --python=python${python_version} ${DIST_DIR}/venv source ${DIST_DIR}/venv/bin/activate pip3 install --exists-action w -r ${CASSANDRA_DTEST_DIR}/requirements.txt diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index faf3f410cf24..3667ab86f7f8 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -390,7 +390,7 @@ def test(command, cell) { withEnv(cell.collect { k, v -> "${k}=${v}" }) { ws("workspace/${JOB_NAME}/${BUILD_NUMBER}/${cell.step}/${cell.arch}/jdk-${cell.jdk}/python-${cell.python}") { fetchSource(cell.step, cell.arch, cell.jdk) - fetchDockerImages(['ubuntu2004_test']) + fetchDockerImages(['ubuntu-test']) def cell_suffix = "_jdk${cell.jdk}_python_${cell.python}_${cell.cython}_${cell.arch}_${cell.split}_${splits}" def logfile = "stage-logs/${JOB_NAME}_${BUILD_NUMBER}_${cell.step}${cell_suffix}_attempt${attempt}.log.xz" def script_vars = "#!/bin/bash \n set -o pipefail ; " // pipe to tee needs pipefail diff --git a/bin/cqlsh b/bin/cqlsh index 2a9651968b4b..25fa029b4f57 100755 --- a/bin/cqlsh +++ b/bin/cqlsh @@ -63,7 +63,7 @@ is_supported_version() { major_version="${version%.*}" minor_version="${version#*.}" # python 3.8-3.11 are supported - if [ "$major_version" = 3 ] && [ "$minor_version" -ge 8 ] && [ "$minor_version" -le 11 ]; then + if [ "$major_version" = 3 ] && [ "$minor_version" -ge 8 ] && [ "$minor_version" -le 13 ]; then echo "supported" # python 3.6-3.7 are deprecated elif [ "$major_version" = 3 ] && [ "$minor_version" -ge 6 ] && [ "$minor_version" -le 7 ]; then @@ -88,7 +88,7 @@ run_if_supported_version() { exec "$interpreter" "$($interpreter -c "import os; print(os.path.dirname(os.path.realpath('$0')))")/cqlsh.py" "$@" exit else - echo "Warning: unsupported version of Python, required 3.6-3.11 but found" "$version" >&2 + echo "Warning: unsupported version of Python, required 3.6-3.13 but found" "$version" >&2 fi fi } diff --git a/bin/cqlsh.py b/bin/cqlsh.py index 738f0aeeb716..5131f990629d 100755 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@ -21,8 +21,8 @@ import sys from glob import glob -if sys.version_info < (3, 6) or sys.version_info >= (3, 12): - sys.exit("\ncqlsh requires Python 3.6-3.11\n") +if sys.version_info < (3, 6) or sys.version_info >= (3, 14): + sys.exit("\ncqlsh requires Python 3.6-3.13\n") # see CASSANDRA-10428 if platform.python_implementation().startswith('Jython'): @@ -56,7 +56,7 @@ def find_zip(libprefix): sys.path.insert(0, os.path.join(cql_zip, 'cassandra-driver-' + ver)) # the driver needs dependencies -third_parties = ('pure_sasl-', 'wcwidth-') +third_parties = ('pure_sasl-', 'wcwidth-', 'pyasyncore-') for lib in third_parties: lib_zip = find_zip(lib) diff --git a/pylib/cassandra-cqlsh-tests.sh b/pylib/cassandra-cqlsh-tests.sh index c80ba438729d..1c0ddbb5bfb5 100755 --- a/pylib/cassandra-cqlsh-tests.sh +++ b/pylib/cassandra-cqlsh-tests.sh @@ -59,7 +59,7 @@ set -e # enable immediate exit if venv setup fails # fresh virtualenv and test logs results everytime rm -fr ${DIST_DIR}/venv ${DIST_DIR}/test/{html,output,logs} -# re-use when possible the pre-installed virtualenv found in the cassandra-ubuntu2004_test docker image +# re-use when possible the pre-installed virtualenv found in the cassandra-ubuntu-test docker image virtualenv-clone ${BUILD_HOME}/env${python_version} ${BUILD_DIR}/venv || virtualenv --python=python3 ${BUILD_DIR}/venv source ${BUILD_DIR}/venv/bin/activate