Skip to content

Commit ec8dffd

Browse files
committed
[MINOR][BUILD] Improve release-build script
Improved release-build.sh based on the 0.5.0-incubating release process. Includes: - Instead of forcing user to set env it prompts for required info, this also protects password inout - Creates temp dir to hold files created in release process and makes sure git ignores it Author: Alex Bozarth <[email protected]> Closes apache#76 from ajbozarth/script.
1 parent f47b742 commit ec8dffd

File tree

2 files changed

+43
-18
lines changed

2 files changed

+43
-18
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ reports/
2323
metastore_db/
2424
derby.log
2525
dependency-reduced-pom.xml
26+
release-staging/
2627

2728
# For python setup.py, which pollutes the source dirs.
2829
python-api/dist

dev/release-build.sh

+42-18
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,36 @@ if [[ $@ == *"help"* ]]; then
5050
exit_with_usage
5151
fi
5252

53-
for env in ASF_USERNAME ASF_PASSWORD GPG_PASSPHRASE RELEASE_RC; do
54-
if [ -z "${!env}" ]; then
55-
echo "ERROR: $env must be set to run this script"
56-
exit_with_usage
57-
fi
58-
done
59-
6053
# Explicitly set locale in order to make `sort` output consistent across machines.
6154
# See https://stackoverflow.com/questions/28881 for more details.
6255
export LC_ALL=C
6356

57+
# Setup env
58+
6459
# Commit ref to checkout when building
65-
GIT_REF=${GIT_REF:-master}
60+
if [ -z "$GIT_REF" ]; then
61+
read -p "Choose git branch/tag [master]: " GIT_REF
62+
GIT_REF=${GIT_REF:-master}
63+
echo $GIT_REF
64+
fi
65+
66+
# Set RELEASE_RC
67+
if [ -z "$RELEASE_RC" ]; then
68+
read -p "Choose RC [rc1]: " RELEASE_RC
69+
RELEASE_RC=${RELEASE_RC:-rc1}
70+
echo $RELEASE_RC
71+
fi
72+
73+
# Get ASF Login
74+
if [ -z "$ASF_USERNAME" ]; then
75+
read -p "ASF username: " ASF_USERNAME
76+
echo $ASF_USERNAME
77+
fi
78+
79+
if [ -z "$ASF_PASSWORD" ]; then
80+
read -s -p "ASF password: " ASF_PASSWORD
81+
echo
82+
fi
6683

6784
# Destination directory on remote server
6885
RELEASE_STAGING_LOCATION="https://dist.apache.org/repos/dist/dev/incubator/livy"
@@ -74,7 +91,11 @@ BASE_DIR=$(pwd)
7491

7592
MVN="mvn"
7693

77-
rm -rf incubator-livy
94+
# Use temp staging dir for release process
95+
rm -rf release-staging
96+
mkdir release-staging
97+
cd release-staging
98+
7899
git clone https://git-wip-us.apache.org/repos/asf/incubator-livy.git
79100
cd incubator-livy
80101
git checkout $GIT_REF
@@ -96,11 +117,11 @@ if [[ "$1" == "package" ]]; then
96117
echo "Packaging release tarballs"
97118
cp -r incubator-livy livy-$LIVY_VERSION-src
98119
zip -r livy-$LIVY_VERSION-src.zip livy-$LIVY_VERSION-src
99-
echo $GPG_PASSPHRASE | $GPG --passphrase-fd 0 --armour --output livy-$LIVY_VERSION-src.zip.asc \
120+
echo "" | $GPG --passphrase-fd 0 --armour --output livy-$LIVY_VERSION-src.zip.asc \
100121
--detach-sig livy-$LIVY_VERSION-src.zip
101-
echo $GPG_PASSPHRASE | $GPG --passphrase-fd 0 --print-md MD5 livy-$LIVY_VERSION-src.zip > \
122+
echo "" | $GPG --passphrase-fd 0 --print-md MD5 livy-$LIVY_VERSION-src.zip > \
102123
livy-$LIVY_VERSION-src.zip.md5
103-
echo $GPG_PASSPHRASE | $GPG --passphrase-fd 0 --print-md \
124+
echo "" | $GPG --passphrase-fd 0 --print-md \
104125
SHA512 livy-$LIVY_VERSION-src.zip > livy-$LIVY_VERSION-src.zip.sha512
105126
rm -rf livy-$LIVY_VERSION-src
106127

@@ -115,13 +136,13 @@ if [[ "$1" == "package" ]]; then
115136

116137
echo "Copying and signing regular binary distribution"
117138
cp assembly/target/livy-$LIVY_VERSION-bin.zip .
118-
echo $GPG_PASSPHRASE | $GPG --passphrase-fd 0 --armour \
139+
echo "" | $GPG --passphrase-fd 0 --armour \
119140
--output livy-$LIVY_VERSION-bin.zip.asc \
120141
--detach-sig livy-$LIVY_VERSION-bin.zip
121-
echo $GPG_PASSPHRASE | $GPG --passphrase-fd 0 --print-md \
142+
echo "" | $GPG --passphrase-fd 0 --print-md \
122143
MD5 livy-$LIVY_VERSION-bin.zip > \
123144
livy-$LIVY_VERSION-bin.zip.md5
124-
echo $GPG_PASSPHRASE | $GPG --passphrase-fd 0 --print-md \
145+
echo "" | $GPG --passphrase-fd 0 --print-md \
125146
SHA512 livy-$LIVY_VERSION-bin.zip > \
126147
livy-$LIVY_VERSION-bin.zip.sha512
127148

@@ -147,7 +168,10 @@ fi
147168

148169
if [[ "$1" == "publish-release" ]]; then
149170
tmp_dir=$(mktemp -d livy-repo-XXXXX)
150-
tmp_repo=`readlink -f "$tmp_dir"`
171+
# the following recreates `readlink -f "$tmp_dir"` since readlink -f is unsupported on MacOS
172+
cd $tmp_dir
173+
tmp_repo=$(pwd)
174+
cd ..
151175

152176
cd incubator-livy
153177
# Publish Livy to Maven release repo
@@ -176,7 +200,7 @@ if [[ "$1" == "publish-release" ]]; then
176200
echo "Creating hash and signature files"
177201
for file in $(find . -type f)
178202
do
179-
echo $GPG_PASSPHRASE | $GPG --passphrase-fd 0 --output $file.asc \
203+
echo "" | $GPG --passphrase-fd 0 --output $file.asc \
180204
--detach-sig --armour $file;
181205
if [ $(command -v md5) ]; then
182206
# Available on OS X; -q to keep only hash
@@ -212,5 +236,5 @@ if [[ "$1" == "publish-release" ]]; then
212236
fi
213237

214238
cd ..
215-
rm -rf incubator-livy
239+
rm -rf release-staging
216240
echo "ERROR: expects to be called with 'package', 'publish-release'"

0 commit comments

Comments
 (0)