From ec26d53d6cae9f5e811a2b43e0c37ccd5a9dbbf4 Mon Sep 17 00:00:00 2001 From: Mick Semb Wever Date: Tue, 1 Apr 2025 13:12:33 +0200 Subject: [PATCH] In ubuntu2004_test automatically find the latest available patch version for each C* major.minor Inspired by https://github.com/apache/cassandra-builds/pull/108 Closes https://github.com/apache/cassandra/pull/4025 patch by Mick Semb Wever; reviewed by Siyao (Jane) He for CASSJAVA-40 --- .build/docker/ubuntu2004_test.docker | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.build/docker/ubuntu2004_test.docker b/.build/docker/ubuntu2004_test.docker index 8ffd24d18a..9d19baef18 100644 --- a/.build/docker/ubuntu2004_test.docker +++ b/.build/docker/ubuntu2004_test.docker @@ -124,22 +124,23 @@ RUN /bin/bash -c "source ${BUILD_HOME}/env3.8/bin/activate && \ ccm create -n 1 -v git:cassandra-4.1 test && ccm remove test && \ ccm create -n 1 -v git:cassandra-4.0 test && ccm remove test" -# Initialize ccm versions. right side of each sequence needs to be updated with new releases. -# this can be checked with: -# `curl -s https://downloads.apache.org/cassandra/ | grep -oP '(?<=href=\")[0-9]+\.[0-9]+\.[0-9]+(?=)' | sort -rV | uniq -w 3` +# Initialize ccm versions. branch heads and all versions iterating through to the latest version found on downloads.apache.org/cassandra RUN bash -c 'source ${BUILD_HOME}/env3.8/bin/activate && \ - for i in {1..14} ; do echo $i ; ccm create --quiet -n 1 -v binary:4.0.$i test && ccm remove test ; done && \ - for i in {1..7} ; do echo $i ; ccm create --quiet -n 1 -v binary:4.1.$i test && ccm remove test ; done' + latest_4_0=$(curl -s https://downloads.apache.org/cassandra/ | grep -oP "(?<=href=\")4\.0\.[0-9]+(?=\")" | sort -V | tail -1 | cut -d"." -f3) && \ + for i in $(seq 1 $latest_4_0); do echo $i ; ccm create --quiet -n 1 -v binary:4.0.$i test && ccm remove test ; done && \ + latest_4_1=$(curl -s https://downloads.apache.org/cassandra/ | grep -oP "(?<=href=\")4\.1\.[0-9]+(?=\")" | sort -V | tail -1 | cut -d"." -f3) && \ + for i in $(seq 1 $latest_4_1); do echo $i ; ccm create --quiet -n 1 -v binary:4.1.$i test && ccm remove test ; done' # 5+ requires java11 RUN sudo update-java-alternatives --set java-1.11.0-openjdk-$(dpkg --print-architecture) -# Initialize the CCM git repo, after removing the git cache, as this also can fail to clone +# Initialize ccm versions. branch heads and all versions iterating through to the latest version found on downloads.apache.org/cassandra RUN rm -fr ${BUILD_HOME}/.ccm/repository/_git_cache_apache RUN /bin/bash -c 'source ${BUILD_HOME}/env3.8/bin/activate && \ ccm create --quiet -n 1 -v git:cassandra-5.0 test && ccm remove test && \ ccm create --quiet -n 1 -v git:trunk test && ccm remove test && \ - for i in {1..2} ; do echo $i ; ccm create --quiet -n 1 -v binary:5.0.$i test && ccm remove test ; done' + latest_5_0=$(curl -s https://downloads.apache.org/cassandra/ | grep -oP "(?<=href=\")5\.0\.[0-9]+(?=\")" | sort -V | tail -1 | cut -d"." -f3) && \ + for i in $(seq 1 $latest_5_0); do echo $i ; ccm create --quiet -n 1 -v binary:5.0.$i test && ccm remove test ; done' # the .git subdirectories to pip installed cassandra-driver breaks virtualenv-clone, so just remove them # and other directories we don't need in image