Skip to content

Commit 029d0ab

Browse files
Add a script to help verify release checks
1 parent 05a3817 commit 029d0ab

File tree

1 file changed

+127
-0
lines changed

1 file changed

+127
-0
lines changed
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
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+
(curl --output /dev/null --silent --head --fail "https://dist.apache.org/repos/dist/dev/cassandra/$1/") || { echo >&2 "Not Found: https://dist.apache.org/repos/dist/dev/cassandra/$1/"; exit 1; }
29+
(curl --output /dev/null --silent --head --fail "$2") || { echo >&2 "Not Found: $2"; exit 1; }
30+
31+
###################
32+
33+
mkdir -p /tmp/$1
34+
cd /tmp/$1
35+
echo "Downloading KEYS"
36+
wget https://downloads.apache.org/cassandra/KEYS
37+
echo "Downloading $2"
38+
wget -Nqnd -e robots=off --recursive --no-parent $2
39+
echo "Downloading https://dist.apache.org/repos/dist/dev/cassandra/$1/"
40+
wget -Nqe robots=off --recursive --no-parent https://dist.apache.org/repos/dist/dev/cassandra/$1/
41+
42+
echo
43+
echo "====== CHECK RESULTS ======"
44+
echo
45+
46+
gpg --import KEYS
47+
48+
(compgen -G "*.asc" >/dev/null) || { echo >&2 "No *.asc files found in $(pwd)"; exit 1; }
49+
for f in *.asc ; do gpg --verify $f ; done
50+
(compgen -G "*.pom" >/dev/null) || { echo >&2 "No *.pom files found in $(pwd)"; exit 1; }
51+
(compgen -G "*.jar" >/dev/null) || { echo >&2 "No *.jar files found in $(pwd)"; exit 1; }
52+
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
53+
54+
cd dist.apache.org/repos/dist/dev/cassandra/$1
55+
(compgen -G "*.asc" >/dev/null) || { echo >&2 "No *.asc files found in $(pwd)"; exit 1; }
56+
for f in *.asc ; do gpg --verify $f ; done
57+
(compgen -G "*.gz" >/dev/null) || { echo >&2 "No *.gz files found in $(pwd)"; exit 1; }
58+
(compgen -G "*.sha256" >/dev/null) || { echo >&2 "No *.sha256 files found in $(pwd)"; exit 1; }
59+
(compgen -G "*.sha512" >/dev/null) || { echo >&2 "No *.sha512 files found in $(pwd)"; exit 1; }
60+
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
61+
62+
echo
63+
rm -fR apache-cassandra-$1-src
64+
tar -xzf apache-cassandra-$1-src.tar.gz
65+
pushd apache-cassandra-$1-src
66+
echo "Source build $(ant artifacts | grep '^BUILD ')"
67+
popd
68+
69+
echo
70+
rm -fR apache-cassandra-$1
71+
tar -xzf apache-cassandra-$1-bin.tar.gz
72+
rm -f procfifo
73+
mkfifo procfifo
74+
timeout 30 apache-cassandra-$1/bin/cassandra -f 2>&1 >procfifo &
75+
PID=$!
76+
success=false
77+
while read LINE && ! $success ; do
78+
if [[ $LINE =~ "Starting listening for CQL clients on" ]] ; then
79+
echo "Binary artefact OK"
80+
kill "$PID"
81+
success=true
82+
fi
83+
done < procfifo
84+
rm -f procfifo
85+
wait "$PID"
86+
if ! $success ; then
87+
echo "Binary artefact FAILED"
88+
fi
89+
90+
echo
91+
rm -f procfifo
92+
mkfifo procfifo
93+
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 procps; 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 &
94+
PID=$!
95+
success=false
96+
while read LINE && ! $success ; do
97+
if [[ $LINE =~ "Starting listening for CQL clients on" ]] ; then
98+
echo "Debian package OK"
99+
kill "$PID"
100+
success=true
101+
fi
102+
done < procfifo
103+
rm -f procfifo
104+
wait "$PID"
105+
if ! $success ; then
106+
echo "Debian package FAILED"
107+
fi
108+
109+
echo
110+
rm -f procfifo
111+
mkfifo procfifo
112+
docker run -i -v `pwd`/redhat:/redhat almalinux timeout 1080 /bin/bash -c "( yum install -y java-1.8.0-openjdk procps-ng ; rpm -i redhat/*.rpm ) 2>/dev/null; cassandra -R -f " 2>&1 >procfifo &
113+
PID=$!
114+
115+
success=false
116+
while read LINE && ! $success ; do
117+
if [[ $LINE =~ "Starting listening for CQL clients on" ]] ; then
118+
echo "Redhat package OK"
119+
kill "$PID"
120+
success=true
121+
fi
122+
done < procfifo
123+
rm -f procfifo
124+
wait "$PID"
125+
if ! $success ; then
126+
echo "Redhat package FAILED"
127+
fi

0 commit comments

Comments
 (0)