From ad19a3fb6a0d247abaff2df5fec88abca0d7d56c Mon Sep 17 00:00:00 2001 From: arvindksi274-ksolves Date: Tue, 24 Feb 2026 11:50:46 +0530 Subject: [PATCH 1/4] CASSANDRA-20181: Fix cqlsh docker build failure by upgrading Ubuntu base images --- pylib/Dockerfile.ubuntu.py3 | 4 ++-- pylib/Dockerfile.ubuntu.py311 | 4 ++-- pylib/Dockerfile.ubuntu.py38 | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pylib/Dockerfile.ubuntu.py3 b/pylib/Dockerfile.ubuntu.py3 index 55a4771098ac..360de9dd6243 100644 --- a/pylib/Dockerfile.ubuntu.py3 +++ b/pylib/Dockerfile.ubuntu.py3 @@ -14,5 +14,5 @@ # See the License for the specific language governing permissions and # limitations under the License. # -FROM ubuntu:bionic -RUN apt-get update && apt-get install -y python3-minimal && update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 +FROM ubuntu:focal +RUN apt-get update && apt-get install -y python3-minimal && update-alternatives --install /usr/bin/python python /usr/bin/python3 1 diff --git a/pylib/Dockerfile.ubuntu.py311 b/pylib/Dockerfile.ubuntu.py311 index aa10923af028..aa7c84cf58e7 100644 --- a/pylib/Dockerfile.ubuntu.py311 +++ b/pylib/Dockerfile.ubuntu.py311 @@ -9,5 +9,5 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -FROM ubuntu:bionic -RUN apt-get update && apt-get install -y python3.11-minimal && update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1 +FROM ubuntu:jammy +RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y gnupg2 software-properties-common && add-apt-repository -y ppa:deadsnakes/ppa && apt-get update && apt-get install -y python3.11-minimal && update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1 diff --git a/pylib/Dockerfile.ubuntu.py38 b/pylib/Dockerfile.ubuntu.py38 index 9697baee35f5..bcd81413654b 100644 --- a/pylib/Dockerfile.ubuntu.py38 +++ b/pylib/Dockerfile.ubuntu.py38 @@ -9,5 +9,5 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -FROM ubuntu:bionic +FROM ubuntu:focal RUN apt-get update && apt-get install -y python3.8-minimal && update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 From 139eee444aba09170a7ecae161c2f7db91dd9c30 Mon Sep 17 00:00:00 2001 From: arvindksi274-ksolves Date: Thu, 26 Feb 2026 15:38:15 +0530 Subject: [PATCH 2/4] CASSANDRA-20181: Remove obsolete cqlsh Dockerfiles and update README --- pylib/Dockerfile.ubuntu.py3 | 18 ------------------ pylib/Dockerfile.ubuntu.py311 | 13 ------------- pylib/Dockerfile.ubuntu.py38 | 13 ------------- pylib/README.asc | 23 +---------------------- 4 files changed, 1 insertion(+), 66 deletions(-) delete mode 100644 pylib/Dockerfile.ubuntu.py3 delete mode 100644 pylib/Dockerfile.ubuntu.py311 delete mode 100644 pylib/Dockerfile.ubuntu.py38 diff --git a/pylib/Dockerfile.ubuntu.py3 b/pylib/Dockerfile.ubuntu.py3 deleted file mode 100644 index 360de9dd6243..000000000000 --- a/pylib/Dockerfile.ubuntu.py3 +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -FROM ubuntu:focal -RUN apt-get update && apt-get install -y python3-minimal && update-alternatives --install /usr/bin/python python /usr/bin/python3 1 diff --git a/pylib/Dockerfile.ubuntu.py311 b/pylib/Dockerfile.ubuntu.py311 deleted file mode 100644 index aa7c84cf58e7..000000000000 --- a/pylib/Dockerfile.ubuntu.py311 +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -FROM ubuntu:jammy -RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y gnupg2 software-properties-common && add-apt-repository -y ppa:deadsnakes/ppa && apt-get update && apt-get install -y python3.11-minimal && update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1 diff --git a/pylib/Dockerfile.ubuntu.py38 b/pylib/Dockerfile.ubuntu.py38 deleted file mode 100644 index bcd81413654b..000000000000 --- a/pylib/Dockerfile.ubuntu.py38 +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -FROM ubuntu:focal -RUN apt-get update && apt-get install -y python3.8-minimal && update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 diff --git a/pylib/README.asc b/pylib/README.asc index 3d56c81f9084..c34c2b397361 100644 --- a/pylib/README.asc +++ b/pylib/README.asc @@ -5,7 +5,6 @@ This directory contains code primarily for cqlsh. cqlsh uses cqlshlib in this di == Requirements . Python 3.8-3.11 (for cqlsh) . virtualenv -. Docker (optional) == Running tests @@ -25,24 +24,4 @@ You can run tests on the python style compliance issues with: $ pycodestyle --ignore E501,E402,E731,W503 **/*.py In order to run tests in a virtual environment for cqlshlib, run cassandra-cqlsh-tests.sh in this directory. It will -automatically setup a virtualenv with the appropriate version of Python and run tests inside it. - -There are Dockerfiles that can be used to test whether cqlsh works with a default, barebones -Python installation. Assuming Cassandra's source is checked out at `$CASSANDRA_DIR`. To test, first -build the Docker image containing the barebones Python installation - - - $ docker build . --file Dockerfile.ubuntu.py3 -t ubuntu-lts-py3 - -Next, run cqlsh inside the newly built image - - - $ docker run -v $CASSANDRA_DIR:/code -it ubuntu-lts-py3:latest /code/bin/cqlsh host.docker.internal - -If `host.docker.internal` isn't supported, then you can use `--net="host"` with `docker run`: - - $ docker run --net="host" -v $CASSANDRA_DIR:/code -it ubuntu-lts-py3:latest /code/bin/cqlsh - -This will try to spawn a cqlsh instance inside the Docker container running Ubuntu LTS (18.04) -with minimal Python installation. It will try to connect to the Cassandra instance running on the -Docker host at port 9042. If you have Cassandra running elsewhere, replace host.docker.internal -with the IP / hostname as usual. Please ensure that the IP / host is accessible from _within_ the -Docker container. +automatically setup a virtualenv with the appropriate version of Python and run tests inside it. \ No newline at end of file From 9c93c198cfc18d550ae1e9d767508d47c1dee619 Mon Sep 17 00:00:00 2001 From: arvindksi274-ksolves Date: Sun, 1 Mar 2026 00:29:30 +0530 Subject: [PATCH 3/4] Update Docker testing instructions in README to use public python:slim images Incorporated reviewer feedback. Updated Overview to reflect Python 2.7 as unsupported and 3.6/3.7 as deprecated. Documented tested Python versions and set requirements to Python 3.8+ for future compatibility. --- pylib/README.asc | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/pylib/README.asc b/pylib/README.asc index c34c2b397361..6e82d3f7b965 100644 --- a/pylib/README.asc +++ b/pylib/README.asc @@ -1,10 +1,12 @@ == Overview This directory contains code primarily for cqlsh. cqlsh uses cqlshlib in this directory. +Currently, cqlshlib drops support for Python 2.7. Python 3.6 and 3.7 are deprecated, making Python 3.8+ the recommended version. == Requirements -. Python 3.8-3.11 (for cqlsh) +. Python 3.8+ (for cqlsh) . virtualenv +. Docker (optional) == Running tests @@ -24,4 +26,20 @@ You can run tests on the python style compliance issues with: $ pycodestyle --ignore E501,E402,E731,W503 **/*.py In order to run tests in a virtual environment for cqlshlib, run cassandra-cqlsh-tests.sh in this directory. It will -automatically setup a virtualenv with the appropriate version of Python and run tests inside it. \ No newline at end of file +automatically setup a virtualenv with the appropriate version of Python and run tests inside it. + +To run cqlsh using publicly available Docker images to connect to Cassandra on the same host, with `$CASSANDRA_DIR` pointing to either the source or install directory where `bin/cqlsh` is located. + +For Python 3.11 (example of a newer supported version): + + $ docker run -v $CASSANDRA_DIR:/code -it python:3.11-slim /code/bin/cqlsh host.docker.internal + +For Python 3.8 (lowest non-deprecated version): + + $ docker run -v $CASSANDRA_DIR:/code -it python:3.8-slim /code/bin/cqlsh host.docker.internal + +If `host.docker.internal` isn't supported, then you can use `--net="host"`: + + $ docker run --net="host" -v $CASSANDRA_DIR:/code -it python:3.11-slim /code/bin/cqlsh + +This will try to spawn a cqlsh instance inside the Docker container with a minimal Python installation. It will try to connect to the Cassandra instance running on the Docker host at port 9042. If you have Cassandra running elsewhere, replace host.docker.internal with the IP / hostname as usual. Please ensure that the IP / host is accessible from _within_ the Docker container. \ No newline at end of file From 24bab1f9e15b0e895666db8fab47485fde67c7e9 Mon Sep 17 00:00:00 2001 From: arvindksi274-ksolves Date: Sun, 1 Mar 2026 00:32:18 +0530 Subject: [PATCH 4/4] Update Docker testing instructions --- pylib/README.asc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pylib/README.asc b/pylib/README.asc index 6e82d3f7b965..78ba87af0107 100644 --- a/pylib/README.asc +++ b/pylib/README.asc @@ -30,11 +30,11 @@ automatically setup a virtualenv with the appropriate version of Python and run To run cqlsh using publicly available Docker images to connect to Cassandra on the same host, with `$CASSANDRA_DIR` pointing to either the source or install directory where `bin/cqlsh` is located. -For Python 3.11 (example of a newer supported version): +For Python 3.11: $ docker run -v $CASSANDRA_DIR:/code -it python:3.11-slim /code/bin/cqlsh host.docker.internal -For Python 3.8 (lowest non-deprecated version): +For Python 3.8: $ docker run -v $CASSANDRA_DIR:/code -it python:3.8-slim /code/bin/cqlsh host.docker.internal