@@ -23,23 +23,19 @@ usage: release-build.sh <package|docs|publish-snapshot|publish-release>
23
23
Creates build deliverables from a Spark commit.
24
24
25
25
Top level targets are
26
- package: Create binary packages and copy them to home .apache
27
- docs: Build docs and copy them to home .apache
26
+ package: Create binary packages and commit them to dist .apache.org/repos/dist/dev/spark/
27
+ docs: Build docs and commit them to dist .apache.org/repos/dist/dev/spark/
28
28
publish-snapshot: Publish snapshot release to Apache snapshots
29
29
publish-release: Publish a release to Apache release repo
30
30
31
31
All other inputs are environment variables
32
32
33
33
GIT_REF - Release tag or commit to build from
34
- SPARK_VERSION - Version of Spark being built (e.g. 2.1.2)
35
34
SPARK_PACKAGE_VERSION - Release identifier in top level package directory (e.g. 2.1.2-rc1)
36
- REMOTE_PARENT_DIR - Parent in which to create doc or release builds.
37
- REMOTE_PARENT_MAX_LENGTH - If set, parent directory will be cleaned to only
38
- have this number of subdirectories (by deleting old ones). WARNING: This deletes data.
35
+ SPARK_VERSION - (optional) Version of Spark being built (e.g. 2.1.2)
39
36
40
37
ASF_USERNAME - Username of ASF committer account
41
38
ASF_PASSWORD - Password of ASF committer account
42
- ASF_RSA_KEY - RSA private key file for ASF committer account
43
39
44
40
GPG_KEY - GPG key used to sign release artifacts
45
41
GPG_PASSPHRASE - Passphrase for GPG key
@@ -57,7 +53,20 @@ if [[ $@ == *"help"* ]]; then
57
53
exit_with_usage
58
54
fi
59
55
60
- for env in ASF_USERNAME ASF_RSA_KEY GPG_PASSPHRASE GPG_KEY; do
56
+ if [[ -z " $ASF_PASSWORD " ]]; then
57
+ echo ' The environment variable ASF_PASSWORD is not set. Enter the password.'
58
+ echo
59
+ stty -echo && printf " ASF password: " && read ASF_PASSWORD && printf ' \n' && stty echo
60
+ fi
61
+
62
+ if [[ -z " $GPG_PASSPHRASE " ]]; then
63
+ echo ' The environment variable GPG_PASSPHRASE is not set. Enter the passphrase to'
64
+ echo ' unlock the GPG signing key that will be used to sign the release!'
65
+ echo
66
+ stty -echo && printf " GPG passphrase: " && read GPG_PASSPHRASE && printf ' \n' && stty echo
67
+ fi
68
+
69
+ for env in ASF_USERNAME GPG_PASSPHRASE GPG_KEY; do
61
70
if [ -z " ${! env} " ]; then
62
71
echo " ERROR: $env must be set to run this script"
63
72
exit_with_usage
@@ -71,8 +80,7 @@ export LC_ALL=C
71
80
# Commit ref to checkout when building
72
81
GIT_REF=${GIT_REF:- master}
73
82
74
- # Destination directory parent on remote server
75
- REMOTE_PARENT_DIR=${REMOTE_PARENT_DIR:-/ home/ $ASF_USERNAME / public_html}
83
+ RELEASE_STAGING_LOCATION=" https://dist.apache.org/repos/dist/dev/spark"
76
84
77
85
GPG=" gpg -u $GPG_KEY --no-tty --batch"
78
86
NEXUS_ROOT=https://repository.apache.org/service/local/staging
@@ -142,50 +150,24 @@ if [ -z "$SPARK_PACKAGE_VERSION" ]; then
142
150
SPARK_PACKAGE_VERSION=" ${SPARK_VERSION} -$( date +%Y_%m_%d_%H_%M) -${git_hash} "
143
151
fi
144
152
145
- DEST_DIR_NAME=" spark-$SPARK_PACKAGE_VERSION "
146
-
147
- function LFTP {
148
- SSH=" ssh -o ConnectTimeout=300 -o StrictHostKeyChecking=no -i $ASF_RSA_KEY "
149
- COMMANDS=$( cat << EOF
150
- set net:max-retries 2 &&
151
- set sftp:connect-program $SSH &&
152
- connect -u $ASF_USERNAME ,p sftp://home.apache.org &&
153
- $@
154
- EOF
155
- )
156
- lftp --norc -c " $COMMANDS "
157
- }
158
- export -f LFTP
159
-
153
+ DEST_DIR_NAME=" $SPARK_PACKAGE_VERSION "
160
154
161
155
git clean -d -f -x
162
156
rm .gitignore
163
157
rm -rf .git
164
158
cd ..
165
159
166
- if [ -n " $REMOTE_PARENT_MAX_LENGTH " ]; then
167
- old_dirs=$(
168
- LFTP nlist $REMOTE_PARENT_DIR \
169
- | grep -v " ^\." \
170
- | sort -r \
171
- | tail -n +$REMOTE_PARENT_MAX_LENGTH )
172
- for old_dir in $old_dirs ; do
173
- echo " Removing directory: $old_dir "
174
- LFTP " rm -rf $REMOTE_PARENT_DIR /$old_dir && exit 0"
175
- done
176
- fi
177
-
178
160
if [[ " $1 " == " package" ]]; then
179
161
# Source and binary tarballs
180
- echo " Packaging release tarballs"
162
+ echo " Packaging release source tarballs"
181
163
cp -r spark spark-$SPARK_VERSION
182
164
tar cvzf spark-$SPARK_VERSION .tgz spark-$SPARK_VERSION
183
165
echo $GPG_PASSPHRASE | $GPG --passphrase-fd 0 --armour --output spark-$SPARK_VERSION .tgz.asc \
184
166
--detach-sig spark-$SPARK_VERSION .tgz
185
167
echo $GPG_PASSPHRASE | $GPG --passphrase-fd 0 --print-md MD5 spark-$SPARK_VERSION .tgz > \
186
168
spark-$SPARK_VERSION .tgz.md5
187
169
echo $GPG_PASSPHRASE | $GPG --passphrase-fd 0 --print-md \
188
- SHA512 spark-$SPARK_VERSION .tgz > spark-$SPARK_VERSION .tgz.sha
170
+ SHA512 spark-$SPARK_VERSION .tgz > spark-$SPARK_VERSION .tgz.sha512
189
171
rm -rf spark-$SPARK_VERSION
190
172
191
173
# Updated for each binary build
@@ -238,7 +220,7 @@ if [[ "$1" == "package" ]]; then
238
220
$R_DIST_NAME .md5
239
221
echo $GPG_PASSPHRASE | $GPG --passphrase-fd 0 --print-md \
240
222
SHA512 $R_DIST_NAME > \
241
- $R_DIST_NAME .sha
223
+ $R_DIST_NAME .sha512
242
224
else
243
225
echo " Creating distribution with PIP package"
244
226
./dev/make-distribution.sh --name $NAME --mvn $MVN_HOME /bin/mvn --tgz --pip $FLAGS \
@@ -257,7 +239,7 @@ if [[ "$1" == "package" ]]; then
257
239
$PYTHON_DIST_NAME .md5
258
240
echo $GPG_PASSPHRASE | $GPG --passphrase-fd 0 --print-md \
259
241
SHA512 $PYTHON_DIST_NAME > \
260
- $PYTHON_DIST_NAME .sha
242
+ $PYTHON_DIST_NAME .sha512
261
243
fi
262
244
263
245
echo " Copying and signing regular binary distribution"
@@ -270,7 +252,7 @@ if [[ "$1" == "package" ]]; then
270
252
spark-$SPARK_VERSION -bin-$NAME .tgz.md5
271
253
echo $GPG_PASSPHRASE | $GPG --passphrase-fd 0 --print-md \
272
254
SHA512 spark-$SPARK_VERSION -bin-$NAME .tgz > \
273
- spark-$SPARK_VERSION -bin-$NAME .tgz.sha
255
+ spark-$SPARK_VERSION -bin-$NAME .tgz.sha512
274
256
}
275
257
276
258
# TODO: Check exit codes of children here:
@@ -284,44 +266,45 @@ if [[ "$1" == "package" ]]; then
284
266
wait
285
267
rm -rf spark-$SPARK_VERSION -bin-* /
286
268
287
- # Copy data
288
- dest_dir=" $REMOTE_PARENT_DIR /${DEST_DIR_NAME} -bin"
289
- echo " Copying release tarballs to $dest_dir "
290
- # Put to new directory:
291
- LFTP mkdir -p $dest_dir || true
292
- LFTP mput -O $dest_dir ' spark-*'
293
- LFTP mput -O $dest_dir ' pyspark-*'
294
- LFTP mput -O $dest_dir ' SparkR_*'
295
- # Delete /latest directory and rename new upload to /latest
296
- LFTP " rm -r -f $REMOTE_PARENT_DIR /latest || exit 0"
297
- LFTP mv $dest_dir " $REMOTE_PARENT_DIR /latest"
298
- # Re-upload a second time and leave the files in the timestamped upload directory:
299
- LFTP mkdir -p $dest_dir || true
300
- LFTP mput -O $dest_dir ' spark-*'
301
- LFTP mput -O $dest_dir ' pyspark-*'
302
- LFTP mput -O $dest_dir ' SparkR_*'
269
+ svn co --depth=empty $RELEASE_STAGING_LOCATION svn-spark
270
+ rm -rf " svn-spark/${DEST_DIR_NAME} -bin"
271
+ mkdir -p " svn-spark/${DEST_DIR_NAME} -bin"
272
+
273
+ echo " Copying release tarballs"
274
+ cp spark-* " svn-spark/${DEST_DIR_NAME} -bin/"
275
+ cp pyspark-* " svn-spark/${DEST_DIR_NAME} -bin/"
276
+ cp SparkR_* " svn-spark/${DEST_DIR_NAME} -bin/"
277
+ svn add " svn-spark/${DEST_DIR_NAME} -bin"
278
+
279
+ cd svn-spark
280
+ svn ci --username $ASF_USERNAME --password " $ASF_PASSWORD " -m" Apache Spark $SPARK_PACKAGE_VERSION "
281
+ cd ..
282
+ rm -rf svn-spark
303
283
exit 0
304
284
fi
305
285
306
286
if [[ " $1 " == " docs" ]]; then
307
287
# Documentation
308
288
cd spark
309
289
echo " Building Spark docs"
310
- dest_dir=" $REMOTE_PARENT_DIR /${DEST_DIR_NAME} -docs"
311
290
cd docs
312
291
# TODO: Make configurable to add this: PRODUCTION=1
313
292
PRODUCTION=1 RELEASE_VERSION=" $SPARK_VERSION " jekyll build
314
- echo " Copying release documentation to $dest_dir "
315
- # Put to new directory:
316
- LFTP mkdir -p $dest_dir || true
317
- LFTP mirror -R _site $dest_dir
318
- # Delete /latest directory and rename new upload to /latest
319
- LFTP " rm -r -f $REMOTE_PARENT_DIR /latest || exit 0"
320
- LFTP mv $dest_dir " $REMOTE_PARENT_DIR /latest"
321
- # Re-upload a second time and leave the files in the timestamped upload directory:
322
- LFTP mkdir -p $dest_dir || true
323
- LFTP mirror -R _site $dest_dir
324
293
cd ..
294
+ cd ..
295
+
296
+ svn co --depth=empty $RELEASE_STAGING_LOCATION svn-spark
297
+ rm -rf " svn-spark/${DEST_DIR_NAME} -docs"
298
+ mkdir -p " svn-spark/${DEST_DIR_NAME} -docs"
299
+
300
+ echo " Copying release documentation"
301
+ cp -R " spark/docs/_site" " svn-spark/${DEST_DIR_NAME} -docs/"
302
+ svn add " svn-spark/${DEST_DIR_NAME} -docs"
303
+
304
+ cd svn-spark
305
+ svn ci --username $ASF_USERNAME --password " $ASF_PASSWORD " -m" Apache Spark $SPARK_PACKAGE_VERSION docs"
306
+ cd ..
307
+ rm -rf svn-spark
325
308
exit 0
326
309
fi
327
310
@@ -399,6 +382,7 @@ if [[ "$1" == "publish-release" ]]; then
399
382
find . -type f | grep -v \. jar | grep -v \. pom | xargs rm
400
383
401
384
echo " Creating hash and signature files"
385
+ # this must have .asc, .md5 and .sha1 - it really doesn't like anything else there
402
386
for file in $( find . -type f)
403
387
do
404
388
echo $GPG_PASSPHRASE | $GPG --passphrase-fd 0 --output $file .asc \
0 commit comments