1
1
#! /bin/bash
2
2
3
3
# Parameters
4
- # $1 release
5
- # $2 maven artefacts url number (as specified in the vote email)
4
+ # $1 staged|released
5
+ # $2 release
6
+ # $3 maven artefacts staging repo id (as specified in the repo url found in the vote email) (ignored for 'released')
6
7
#
7
- # Example use: `./cassandra-check-release.sh 4.0-beta3 1224
8
+ # Example use: `./cassandra-check-release.sh staged 4.0-beta3 1224
8
9
#
9
10
# This script is very basic and experimental. I beg of you to help improve it.
10
11
#
@@ -19,25 +20,32 @@ command -v md5sum >/dev/null 2>&1 || { echo >&2 "md5sum needs to be installed";
19
20
command -v sha256sum > /dev/null 2>&1 || { echo >&2 " sha256sum needs to be installed" ; exit 1; }
20
21
command -v sha512sum > /dev/null 2>&1 || { echo >&2 " sha512sum needs to be installed" ; exit 1; }
21
22
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
23
command -v docker > /dev/null 2>&1 || { echo >&2 " docker needs to be installed" ; exit 1; }
25
24
(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 " https://repository.apache.org/content/repositories/orgapachecassandra-$2 /org/apache/cassandra/cassandra-all/$1 " ) || { echo >&2 " Not Found: https://repository.apache.org/content/repositories/orgapachecassandra-$2 /org/apache/cassandra/cassandra-all/$1 " ; exit 1; }
25
+
26
+ ( [ " staged" = $1 ] || [ " released" = $1 ] ) || { echo >&2 " first argument must be staged or released" ; exit 1; }
27
+ ( [ $# -ge 2 ] ) || { echo >&2 " minimum two arguments must be provided" ; exit 1; }
28
+ if [ -z " $3 " ] ; then
29
+ [ " released" == $1 ] || { echo >&2 " third argument must not be specified when first is released" ; exit 1; }
30
+ maven_repo_url=" https://repository.apache.org/content/repositories/releases/org/apache/cassandra/cassandra-all/$2 "
31
+ else
32
+ [ " staged" == $1 ] || { echo >&2 " third argument must be specified when first is staged" ; exit 1; }
33
+ maven_repo_url=" https://repository.apache.org/content/repositories/orgapachecassandra-$3 /org/apache/cassandra/cassandra-all/$2 "
34
+ fi
35
+ (curl --output /dev/null --silent --head --fail " https://dist.apache.org/repos/dist/dev/cassandra/$2 /" ) || { echo >&2 " Not Found: https://dist.apache.org/repos/dist/dev/cassandra/$2 /" ; exit 1; }
36
+ (curl --output /dev/null --silent --head --fail " ${maven_repo_url} " ) || { echo >&2 " Not found: ${maven_repo_url} " ; exit 1; }
37
+
30
38
31
39
# ##################
32
40
33
- mkdir -p /tmp/$1
34
- cd /tmp/$1
41
+ mkdir -p /tmp/$2
42
+ cd /tmp/$2
35
43
echo " Downloading KEYS"
36
44
wget -q https://downloads.apache.org/cassandra/KEYS
37
- echo " Downloading https://repository.apache.org/content/repositories/orgapachecassandra- $2 /org/apache/cassandra/cassandra-all/ $1 "
38
- wget -Nqnd -e robots=off --recursive --no-parent https://repository.apache.org/content/repositories/orgapachecassandra- $2 /org/apache/cassandra/cassandra-all/ $1
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 /
45
+ echo " Downloading ${maven_repo_url} "
46
+ wget -Nqnd -e robots=off --recursive --no-parent ${maven_repo_url}
47
+ echo " Downloading https://dist.apache.org/repos/dist/dev/cassandra/$2 /"
48
+ wget -Nqe robots=off --recursive --no-parent https://dist.apache.org/repos/dist/dev/cassandra/$2 /
41
49
42
50
echo
43
51
echo " ====== CHECK RESULTS ======"
@@ -51,7 +59,7 @@ for f in *.asc ; do gpg --verify $f ; done
51
59
(compgen -G " *.jar" > /dev/null) || { echo >&2 " No *.jar files found in $( pwd) " ; exit 1; }
52
60
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
61
54
- cd dist.apache.org/repos/dist/dev/cassandra/$1
62
+ cd dist.apache.org/repos/dist/dev/cassandra/$2
55
63
(compgen -G " *.asc" > /dev/null) || { echo >&2 " No *.asc files found in $( pwd) " ; exit 1; }
56
64
for f in * .asc ; do gpg --verify $f ; done
57
65
(compgen -G " *.gz" > /dev/null) || { echo >&2 " No *.gz files found in $( pwd) " ; exit 1; }
@@ -60,17 +68,18 @@ for f in *.asc ; do gpg --verify $f ; done
60
68
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
69
62
70
echo
63
- rm -fR apache-cassandra-$1 -src
64
- tar -xzf apache-cassandra-$1 -src.tar.gz
65
- rm -fR apache-cassandra-$1
66
- tar -xzf apache-cassandra-$1 -bin.tar.gz
71
+ rm -fR apache-cassandra-$2 -src
72
+ tar -xzf apache-cassandra-$2 -src.tar.gz
73
+ rm -fR apache-cassandra-$2
74
+ tar -xzf apache-cassandra-$2 -bin.tar.gz
67
75
68
76
JDKS=" 8"
69
- if [[ $1 =~ [4]\. ]] ; then
77
+ if [[ $2 =~ [4]\. ]] ; then
70
78
JDKS=(" 8" " 11" )
71
- elif [[ $1 =~ [5]\. ]] ; then
79
+ elif [[ $2 =~ [5]\. ]] ; then
72
80
JDKS=(" 11" " 17" )
73
81
fi
82
+ TIMEOUT=2160
74
83
75
84
for JDK in ${JDKS[@]} ; do
76
85
@@ -82,10 +91,10 @@ for JDK in ${JDKS[@]} ; do
82
91
echo
83
92
rm -f procfifo
84
93
mkfifo procfifo
85
- docker run -i -v ` pwd` /apache-cassandra-$1 -src:/apache-cassandra-$1 -src openjdk:${JDK} -jdk-slim-buster timeout 2160 /bin/bash -c "
94
+ docker run -i -v ` pwd` /apache-cassandra-$2 -src:/apache-cassandra-$2 -src openjdk:${JDK} -jdk-slim-buster timeout ${TIMEOUT} /bin/bash -c "
86
95
( apt -qq update;
87
96
apt -qq install -y ant build-essential git python procps ) 2>&1 >/dev/null;
88
- cd apache-cassandra-$1 -src ;
97
+ cd apache-cassandra-$2 -src ;
89
98
ant artifacts ${BUILD_OPT} " 2>&1 > procfifo &
90
99
91
100
PID=$!
@@ -108,10 +117,10 @@ for JDK in ${JDKS[@]} ; do
108
117
echo
109
118
rm -f procfifo
110
119
mkfifo procfifo
111
- docker run -i -v ` pwd` /apache-cassandra-$1 :/apache-cassandra-$1 openjdk:${JDK} -jdk-slim-buster timeout 2160 /bin/bash -c "
120
+ docker run -i -v ` pwd` /apache-cassandra-$2 :/apache-cassandra-$2 openjdk:${JDK} -jdk-slim-buster timeout ${TIMEOUT} /bin/bash -c "
112
121
( apt -qq update;
113
122
apt -qq install -y python python3 procps ) 2>&1 >/dev/null;
114
- apache-cassandra-$1 /bin/cassandra -R -f" 2>&1 > procfifo &
123
+ apache-cassandra-$2 /bin/cassandra -R -f" 2>&1 > procfifo &
115
124
116
125
PID=$!
117
126
success=false
@@ -138,7 +147,7 @@ for JDK in ${JDKS[@]} ; do
138
147
echo
139
148
rm -f procfifo
140
149
mkfifo procfifo
141
- docker run -i -v ` pwd` /debian:/debian ${DEBIAN_IMAGE} timeout 2160 /bin/bash -c "
150
+ docker run -i -v ` pwd` /debian:/debian ${DEBIAN_IMAGE} timeout ${TIMEOUT} /bin/bash -c "
142
151
( apt -qq update ;
143
152
apt -qq install -y python ; # will silently fail on debian latest
144
153
apt -qq install -y python3 procps ;
@@ -163,20 +172,20 @@ for JDK in ${JDKS[@]} ; do
163
172
164
173
# test deb repository startup
165
174
166
- idx=` expr index " $1 " -`
175
+ idx=` expr index " $2 " -`
167
176
if [ $idx -eq 0 ]
168
177
then
169
- release_short=${1 }
178
+ release_short=${2 }
170
179
else
171
- release_short=${1 : 0: $((idx-1))}
180
+ release_short=${2 : 0: $((idx-1))}
172
181
fi
173
182
debian_series=" $( echo ${release_short} | cut -d ' .' -f 1) $( echo ${release_short} | cut -d ' .' -f 2) x"
174
183
175
184
echo
176
185
rm -f procfifo
177
186
mkfifo procfifo
178
- docker run -i ${DEBIAN_IMAGE} timeout 2160 /bin/bash -c "
179
- ( echo 'deb https://dist.apache.org/repos/dist/dev/cassandra/${1 } /debian ${debian_series} main' | tee -a /etc/apt/sources.list.d/cassandra.sources.list ;
187
+ docker run -i ${DEBIAN_IMAGE} timeout ${TIMEOUT} /bin/bash -c "
188
+ ( echo 'deb https://dist.apache.org/repos/dist/dev/cassandra/${2 } /debian ${debian_series} main' | tee -a /etc/apt/sources.list.d/cassandra.sources.list ;
180
189
apt -qq update ;
181
190
apt -qq install -y curl gnupg2 ;
182
191
apt-key adv --keyserver keyserver.ubuntu.com --recv-key E91335D77E3E87CB ;
@@ -207,13 +216,13 @@ for JDK in ${JDKS[@]} ; do
207
216
fi
208
217
209
218
RH_DISTS=" almalinux"
210
- if ! [[ $1 =~ [23]\. ]] ; then
211
- RH_DISTS=(" almalinux" " centos:7 " )
219
+ if ! [[ $2 =~ [23]\. ]] ; then
220
+ RH_DISTS=(" almalinux" " noboolean " )
212
221
fi
213
222
for RH_DIST in ${RH_DISTS[@]} ; do
214
223
215
224
NOBOOLEAN_REPO=" "
216
- if [ " $RH_DIST " == " centos:7 " ] ; then
225
+ if [ " $RH_DIST " == " noboolean " ] ; then
217
226
NOBOOLEAN_REPO=" /noboolean"
218
227
fi
219
228
@@ -222,9 +231,9 @@ for JDK in ${JDKS[@]} ; do
222
231
echo
223
232
rm -f procfifo
224
233
mkfifo procfifo
225
- docker run -i -v ` pwd` /redhat${NOBOOLEAN_REPO} :/redhat ${RH_DIST} timeout 2160 /bin/bash -c "
234
+ docker run -i -v ` pwd` /redhat${NOBOOLEAN_REPO} :/redhat almalinux timeout ${TIMEOUT} /bin/bash -c "
226
235
( yum install -y procps-ng python3-pip;
227
- if [ " centos:7 " == " $RH_DIST " ] && [ " java-17-openjdk-devel" == " $JDK_RH " ] ; then
236
+ if [ " noboolean " == " $RH_DIST " ] && [ " java-17-openjdk-devel" == " $JDK_RH " ] ; then
228
237
# centos7 doesn't have jdk17, so manual install ;
229
238
curl https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.rpm -o jdk-17_linux-x64_bin.rpm ;
230
239
yum -y install ./jdk-17_linux-x64_bin.rpm ;
@@ -255,10 +264,10 @@ for JDK in ${JDKS[@]} ; do
255
264
rm -f procfifo
256
265
mkfifo procfifo
257
266
# yum repo installation failing due to a legacy (SHA1) third-party sig in our KEYS file, hence use of update-crypto-policies. Impacts all rhel9+ users.
258
- docker run -i ${RH_DIST} timeout 2160 /bin/bash -c " (
267
+ docker run -i almalinux timeout ${TIMEOUT} /bin/bash -c " (
259
268
echo '[cassandra]' >> /etc/yum.repos.d/cassandra.repo ;
260
269
echo 'name=Apache Cassandra' >> /etc/yum.repos.d/cassandra.repo ;
261
- echo 'baseurl=https://dist.apache.org/repos/dist/dev/cassandra/${1 } /redhat${NOBOOLEAN_REPO} ' >> /etc/yum.repos.d/cassandra.repo ;
270
+ echo 'baseurl=https://dist.apache.org/repos/dist/dev/cassandra/${2 } /redhat${NOBOOLEAN_REPO} ' >> /etc/yum.repos.d/cassandra.repo ;
262
271
echo 'gpgcheck=1' >> /etc/yum.repos.d/cassandra.repo ;
263
272
echo 'repo_gpgcheck=1' >> /etc/yum.repos.d/cassandra.repo ;
264
273
echo 'gpgkey=https://downloads.apache.org/cassandra/KEYS' >> /etc/yum.repos.d/cassandra.repo ;
0 commit comments