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,52 @@ 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
+ dist_url=" https://dist.apache.org/repos/dist/release/cassandra/$2 /"
31
+ maven_repo_url=" https://repository.apache.org/content/repositories/releases/org/apache/cassandra/cassandra-all/$2 "
32
+ debian_url=" https://debian.cassandra.apache.org/"
33
+ redhat_url=" https://redhat.cassandra.apache.org/"
34
+ else
35
+ [ " staged" == $1 ] || { echo >&2 " third argument must be specified when first is staged" ; exit 1; }
36
+ dist_url=" https://dist.apache.org/repos/dist/dev/cassandra/$2 /"
37
+ maven_repo_url=" https://repository.apache.org/content/repositories/orgapachecassandra-$3 /org/apache/cassandra/cassandra-all/$2 "
38
+ debian_url=" https://dist.apache.org/repos/dist/dev/cassandra/${2} /debian/"
39
+ redhat_url=" https://dist.apache.org/repos/dist/dev/cassandra/${2} /redhat/"
40
+ fi
41
+ (curl --output /dev/null --silent --head --fail " ${dist_url} " ) || { echo >&2 " Not Found: ${dist_url} " ; exit 1; }
42
+ (curl --output /dev/null --silent --head --fail " ${maven_repo_url} " ) || { echo >&2 " Not found: ${maven_repo_url} " ; exit 1; }
30
43
31
44
# ##################
32
45
33
- mkdir -p /tmp/$1
34
- cd /tmp/$1
46
+ idx=` expr index " $2 " -`
47
+ if [ $idx -eq 0 ] ; then
48
+ release_short=${2}
49
+ else
50
+ release_short=${2: 0: $((idx-1))}
51
+ fi
52
+ packaging_series=" $( echo ${release_short} | cut -d ' .' -f 1) $( echo ${release_short} | cut -d ' .' -f 2) x"
53
+
54
+ mkdir -p /tmp/$2
55
+ cd /tmp/$2
35
56
echo " Downloading KEYS"
36
57
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 /
58
+ echo " Downloading ${maven_repo_url} "
59
+ wget -Nqnd -e robots=off --recursive --no-parent ${maven_repo_url}
60
+ echo " Downloading ${dist_url} "
61
+ wget -Nqe robots=off --recursive --no-parent ${dist_url}
62
+ if [ -z " $3 " ] ; then
63
+ mkdir dist.apache.org/repos/dist/release/cassandra/$2 /{debian,redhat}
64
+ echo " Downloading ${debian_url} /pool/main/c/cassandra/*${2/ -/ \~ } /*.deb"
65
+ wget -Nqe robots=off --recursive --no-parent -A " *${2/ -/ \~ } *.deb" -P dist.apache.org/repos/dist/release/cassandra/$2 /debian ${debian_url} /pool/main/c/cassandra/
66
+ echo " Downloading ${redhat_url} /${packaging_series} /**/*${2/ -/ \~ } *.rpm"
67
+ wget -Nqe robots=off --recursive --no-parent -A " *${2/ -/ \~ } *.rpm" -P dist.apache.org/repos/dist/release/cassandra/$2 /redhat ${redhat_url} /${packaging_series} /
68
+ fi
41
69
42
70
echo
43
71
echo " ====== CHECK RESULTS ======"
@@ -51,7 +79,7 @@ for f in *.asc ; do gpg --verify $f ; done
51
79
(compgen -G " *.jar" > /dev/null) || { echo >&2 " No *.jar files found in $( pwd) " ; exit 1; }
52
80
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
81
54
- cd dist.apache.org/repos/dist/dev /cassandra/$1
82
+ cd dist.apache.org/repos/dist/* /cassandra/$2
55
83
(compgen -G " *.asc" > /dev/null) || { echo >&2 " No *.asc files found in $( pwd) " ; exit 1; }
56
84
for f in * .asc ; do gpg --verify $f ; done
57
85
(compgen -G " *.gz" > /dev/null) || { echo >&2 " No *.gz files found in $( pwd) " ; exit 1; }
@@ -60,17 +88,18 @@ for f in *.asc ; do gpg --verify $f ; done
60
88
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
89
62
90
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
91
+ rm -fR apache-cassandra-$2 -src
92
+ tar -xzf apache-cassandra-$2 -src.tar.gz
93
+ rm -fR apache-cassandra-$2
94
+ tar -xzf apache-cassandra-$2 -bin.tar.gz
67
95
68
96
JDKS=" 8"
69
- if [[ $1 =~ [4]\. ]] ; then
97
+ if [[ $2 =~ [4]\. ]] ; then
70
98
JDKS=(" 8" " 11" )
71
- elif [[ $1 =~ [5]\. ]] ; then
99
+ elif [[ $2 =~ [5]\. ]] ; then
72
100
JDKS=(" 11" " 17" )
73
101
fi
102
+ TIMEOUT=2160
74
103
75
104
for JDK in ${JDKS[@]} ; do
76
105
@@ -82,10 +111,10 @@ for JDK in ${JDKS[@]} ; do
82
111
echo
83
112
rm -f procfifo
84
113
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 "
114
+ docker run -i -v ` pwd` /apache-cassandra-$2 -src:/apache-cassandra-$2 -src openjdk:${JDK} -jdk-slim-buster timeout ${TIMEOUT} /bin/bash -c "
86
115
( apt -qq update;
87
116
apt -qq install -y ant build-essential git python procps ) 2>&1 >/dev/null;
88
- cd apache-cassandra-$1 -src ;
117
+ cd apache-cassandra-$2 -src ;
89
118
ant artifacts ${BUILD_OPT} " 2>&1 > procfifo &
90
119
91
120
PID=$!
@@ -108,10 +137,10 @@ for JDK in ${JDKS[@]} ; do
108
137
echo
109
138
rm -f procfifo
110
139
mkfifo procfifo
111
- docker run -i -v ` pwd` /apache-cassandra-$1 :/apache-cassandra-$1 openjdk:${JDK} -jdk-slim-buster timeout 2160 /bin/bash -c "
140
+ docker run -i -v ` pwd` /apache-cassandra-$2 :/apache-cassandra-$2 openjdk:${JDK} -jdk-slim-buster timeout ${TIMEOUT} /bin/bash -c "
112
141
( apt -qq update;
113
142
apt -qq install -y python python3 procps ) 2>&1 >/dev/null;
114
- apache-cassandra-$1 /bin/cassandra -R -f" 2>&1 > procfifo &
143
+ apache-cassandra-$2 /bin/cassandra -R -f" 2>&1 > procfifo &
115
144
116
145
PID=$!
117
146
success=false
@@ -138,7 +167,7 @@ for JDK in ${JDKS[@]} ; do
138
167
echo
139
168
rm -f procfifo
140
169
mkfifo procfifo
141
- docker run -i -v ` pwd` /debian:/debian ${DEBIAN_IMAGE} timeout 2160 /bin/bash -c "
170
+ docker run -i -v ` pwd` /debian:/debian ${DEBIAN_IMAGE} timeout ${TIMEOUT} /bin/bash -c "
142
171
( apt -qq update ;
143
172
apt -qq install -y python ; # will silently fail on debian latest
144
173
apt -qq install -y python3 procps ;
@@ -163,20 +192,11 @@ for JDK in ${JDKS[@]} ; do
163
192
164
193
# test deb repository startup
165
194
166
- idx=` expr index " $1 " -`
167
- if [ $idx -eq 0 ]
168
- then
169
- release_short=${1}
170
- else
171
- release_short=${1: 0: $((idx-1))}
172
- fi
173
- debian_series=" $( echo ${release_short} | cut -d ' .' -f 1) $( echo ${release_short} | cut -d ' .' -f 2) x"
174
-
175
195
echo
176
196
rm -f procfifo
177
197
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 ;
198
+ docker run -i ${DEBIAN_IMAGE} timeout ${TIMEOUT} /bin/bash -c "
199
+ ( echo 'deb ${debian_url} ${packaging_series } main' | tee -a /etc/apt/sources.list.d/cassandra.sources.list ;
180
200
apt -qq update ;
181
201
apt -qq install -y curl gnupg2 ;
182
202
apt-key adv --keyserver keyserver.ubuntu.com --recv-key E91335D77E3E87CB ;
@@ -207,30 +227,28 @@ for JDK in ${JDKS[@]} ; do
207
227
fi
208
228
209
229
RH_DISTS=" almalinux"
210
- if ! [[ $1 =~ [23]\. ]] ; then
211
- RH_DISTS=(" almalinux" " centos:7 " )
230
+ if ! [[ $2 =~ [23]\. ]] ; then
231
+ RH_DISTS=(" almalinux" " noboolean " )
212
232
fi
213
233
for RH_DIST in ${RH_DISTS[@]} ; do
214
234
215
235
NOBOOLEAN_REPO=" "
216
- if [ " $RH_DIST " == " centos:7 " ] ; then
236
+ if [ " $RH_DIST " == " noboolean " ] ; then
217
237
NOBOOLEAN_REPO=" /noboolean"
218
238
fi
239
+ REPO_VERSION=" "
240
+ if [ " released" == " $1 " ] ; then
241
+ REPO_VERSION=" ${packaging_series} "
242
+ fi
219
243
220
244
# test rpm package startup
221
245
222
246
echo
223
247
rm -f procfifo
224
248
mkfifo procfifo
225
- docker run -i -v ` pwd` /redhat${NOBOOLEAN_REPO} :/redhat ${RH_DIST} timeout 2160 /bin/bash -c "
249
+ docker run -i -v ` pwd` /redhat${NOBOOLEAN_REPO} :/redhat almalinux timeout ${TIMEOUT} /bin/bash -c "
226
250
( yum install -y procps-ng python3-pip;
227
- if [ " centos:7" == " $RH_DIST " ] && [ " java-17-openjdk-devel" == " $JDK_RH " ] ; then
228
- # centos7 doesn't have jdk17, so manual install ;
229
- curl https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.rpm -o jdk-17_linux-x64_bin.rpm ;
230
- yum -y install ./jdk-17_linux-x64_bin.rpm ;
231
- else
232
- yum install -y ${JDK_RH} ;
233
- fi
251
+ yum install -y ${JDK_RH} ;
234
252
rpm -i --nodeps redhat/*.rpm ) 2>&1 >/dev/null ;
235
253
cassandra -R -f " 2>&1 > procfifo &
236
254
@@ -255,10 +273,10 @@ for JDK in ${JDKS[@]} ; do
255
273
rm -f procfifo
256
274
mkfifo procfifo
257
275
# 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 " (
276
+ docker run -i almalinux timeout ${TIMEOUT} /bin/bash -c " (
259
277
echo '[cassandra]' >> /etc/yum.repos.d/cassandra.repo ;
260
278
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 ;
279
+ echo 'baseurl=${redhat_url}${REPO_VERSION} ${NOBOOLEAN_REPO} ' >> /etc/yum.repos.d/cassandra.repo ;
262
280
echo 'gpgcheck=1' >> /etc/yum.repos.d/cassandra.repo ;
263
281
echo 'repo_gpgcheck=1' >> /etc/yum.repos.d/cassandra.repo ;
264
282
echo 'gpgkey=https://downloads.apache.org/cassandra/KEYS' >> /etc/yum.repos.d/cassandra.repo ;
0 commit comments