|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Parameters |
| 4 | +# $1 release |
| 5 | +# $2 maven artefacts url (as specified in the vote email) |
| 6 | +# |
| 7 | +# Example use: `./cassandra-check-release.sh 4.0-beta3 https://repository.apache.org/content/repositories/orgapachecassandra-1224/org/apache/cassandra/cassandra-all/4.0-beta3/` |
| 8 | +# |
| 9 | +# This script is very basic and experimental. I beg of you to help improve it. |
| 10 | +# |
| 11 | + |
| 12 | +################### |
| 13 | +# prerequisites |
| 14 | + |
| 15 | +command -v wget >/dev/null 2>&1 || { echo >&2 "wget needs to be installed"; exit 1; } |
| 16 | +command -v gpg >/dev/null 2>&1 || { echo >&2 "gpg needs to be installed"; exit 1; } |
| 17 | +command -v sha1sum >/dev/null 2>&1 || { echo >&2 "sha1sum needs to be installed"; exit 1; } |
| 18 | +command -v md5sum >/dev/null 2>&1 || { echo >&2 "md5sum needs to be installed"; exit 1; } |
| 19 | +command -v sha256sum >/dev/null 2>&1 || { echo >&2 "sha256sum needs to be installed"; exit 1; } |
| 20 | +command -v sha512sum >/dev/null 2>&1 || { echo >&2 "sha512sum needs to be installed"; exit 1; } |
| 21 | +command -v tar >/dev/null 2>&1 || { echo >&2 "tar needs to be installed"; exit 1; } |
| 22 | +command -v ant >/dev/null 2>&1 || { echo >&2 "ant needs to be installed"; exit 1; } |
| 23 | +command -v timeout >/dev/null 2>&1 || { echo >&2 "timeout needs to be installed"; exit 1; } |
| 24 | +command -v docker >/dev/null 2>&1 || { echo >&2 "docker needs to be installed"; exit 1; } |
| 25 | +(docker info >/dev/null 2>&1) || { echo >&2 "docker needs to running"; exit 1; } |
| 26 | +(java -version 2>&1 | grep -q "1.8") || { echo >&2 "Java 8 must be used"; exit 1; } |
| 27 | +(java -version 2>&1 | grep -iq jdk ) || { echo >&2 "Java JDK must be used"; exit 1; } |
| 28 | + |
| 29 | +################### |
| 30 | + |
| 31 | +mkdir -p /tmp/$1 |
| 32 | +cd /tmp/$1 |
| 33 | +echo "Downloading KEYS" |
| 34 | +wget https://downloads.apache.org/cassandra/KEYS |
| 35 | +echo "Downloading $2" |
| 36 | +wget -Nqnd -e robots=off --recursive --no-parent $2 |
| 37 | +echo "Downloading https://dist.apache.org/repos/dist/dev/cassandra/$1/" |
| 38 | +wget -Nqe robots=off --recursive --no-parent https://dist.apache.org/repos/dist/dev/cassandra/$1/ |
| 39 | + |
| 40 | +echo |
| 41 | +echo "====== CHECK RESULTS ======" |
| 42 | +echo |
| 43 | + |
| 44 | +gpg --import KEYS |
| 45 | + |
| 46 | +for f in *.asc ; do gpg --verify $f ; done |
| 47 | +for f in *.pom *.jar *.asc ; do echo -n "sha1: " ; echo "$(cat $f.sha1) $f" | sha1sum -c ; echo -n "md5: " ; echo "$(cat $f.md5) $f" | md5sum -c ; done |
| 48 | + |
| 49 | +cd dist.apache.org/repos/dist/dev/cassandra/$1 |
| 50 | +for f in *.asc ; do gpg --verify $f ; done |
| 51 | +for f in *.gz ; do echo -n "sha256: " ; echo "$(cat $f.sha256) $f" | sha256sum -c ; echo -n "sha512:" ; echo "$(cat $f.sha512) $f" | sha512sum -c ; done |
| 52 | + |
| 53 | +echo |
| 54 | +rm -fR apache-cassandra-$1-src |
| 55 | +tar -xjf apache-cassandra-$1-src.tar.gz |
| 56 | +pushd apache-cassandra-$1-src |
| 57 | +echo "Source build $(ant artifacts | grep '^BUILD ')" |
| 58 | +popd |
| 59 | + |
| 60 | +echo |
| 61 | +rm -fR apache-cassandra-$1 |
| 62 | +tar -xjf apache-cassandra-$1-bin.tar.gz |
| 63 | +rm -f procfifo |
| 64 | +mkfifo procfifo |
| 65 | +timeout 30 apache-cassandra-$1/bin/cassandra -f 2>&1 >procfifo & |
| 66 | +PID=$! |
| 67 | +success=false |
| 68 | +while read LINE && ! $success ; do |
| 69 | + if [[ $LINE =~ "Starting listening for CQL clients on" ]] ; then |
| 70 | + echo "Binary artefact OK" |
| 71 | + kill "$PID" |
| 72 | + success=true |
| 73 | + fi |
| 74 | +done < procfifo |
| 75 | +rm -f procfifo |
| 76 | +wait "$PID" |
| 77 | +if ! $success ; then |
| 78 | + echo "Binary artefact FAILED" |
| 79 | +fi |
| 80 | + |
| 81 | +echo |
| 82 | +rm -f procfifo |
| 83 | +mkfifo procfifo |
| 84 | +docker run -i -v `pwd`/debian:/debian openjdk:8-jdk-slim-buster timeout 1080 /bin/bash -c "( apt -qq update; apt -qq install -y python python3; dpkg --ignore-depends=java7-runtime --ignore-depends=java8-runtime -i debian/*.deb ) 2>/dev/null; CASSANDRA_CONF=file:///etc/cassandra/ HEAP_NEWSIZE=500m MAX_HEAP_SIZE=1g cassandra -R -f" 2>&1 >procfifo & |
| 85 | +PID=$! |
| 86 | +success=false |
| 87 | +while read LINE && ! $success ; do |
| 88 | + if [[ $LINE =~ "Starting listening for CQL clients on" ]] ; then |
| 89 | + echo "Debian package OK" |
| 90 | + kill "$PID" |
| 91 | + success=true |
| 92 | + fi |
| 93 | +done < procfifo |
| 94 | +rm -f procfifo |
| 95 | +wait "$PID" |
| 96 | +if ! $success ; then |
| 97 | + echo "Debian package FAILED" |
| 98 | +fi |
| 99 | + |
| 100 | +echo |
| 101 | +rm -f procfifo |
| 102 | +mkfifo procfifo |
| 103 | +docker run -i -v `pwd`/redhat:/redhat almalinux timeout 1080 /bin/bash -c "( yum install -y java-1.8.0-openjdk ; rpm -i redhat/*.rpm ) 2>/dev/null; cassandra -R -f " 2>&1 >procfifo & |
| 104 | +PID=$! |
| 105 | + |
| 106 | +success=false |
| 107 | +while read LINE && ! $success ; do |
| 108 | + if [[ $LINE =~ "Starting listening for CQL clients on" ]] ; then |
| 109 | + echo "Redhat package OK" |
| 110 | + kill "$PID" |
| 111 | + success=true |
| 112 | + fi |
| 113 | +done < procfifo |
| 114 | +rm -f procfifo |
| 115 | +wait "$PID" |
| 116 | +if ! $success ; then |
| 117 | + echo "Redhat package FAILED" |
| 118 | +fi |
0 commit comments