Skip to content

Commit 7ee6d59

Browse files
authored
HBASE-23092 Make the RM tooling in dev-tools/create-release generic (#671)
Make the scripts generic. Adds an option that allows you specify 'project'. Defaults to 'hbase' for core. Pass 'hbase-thirdparty' or 'hbase-operator-tools' etc. This commit includes a bunch of bugfixes and miscellaneous that came of trying to use the scripts making RCs. Signed-off-by: Peter Somogyi <psomogyi@apache.org>
1 parent 2ebdcbc commit 7ee6d59

File tree

7 files changed

+288
-205
lines changed

7 files changed

+288
-205
lines changed

dev-support/create-release/README.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Entrance script is _do-release-docker.sh_. Requires a local docker;
22
for example, on mac os x, Docker for Desktop installed and running.
33

4+
For usage, pass '-h':
5+
6+
$ ./do-release-docker.sh -h
7+
8+
To run a build w/o invoking docker (not recommeneded!), use
9+
_do_release.sh_. It does not take parameters. It will ask
10+
you what commands to run with taking defaults from environment.
11+
412
Before starting the RC build, run a reconciliation of what is in
513
JIRA with what is in the commit log. Make sure they align and that
614
anomalies are explained up in JIRA.

dev-support/create-release/do-release-docker.sh

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env bash
2-
32
#
43
# Licensed to the Apache Software Foundation (ASF) under one or more
54
# contributor license agreements. See the NOTICE file distributed with
@@ -47,24 +46,30 @@
4746
# 1. https://github.com/apache/spark/tree/master/dev/create-release
4847
#
4948
set -e
50-
SELF=$(cd $(dirname $0) && pwd)
49+
50+
# Set this building other hbase repos: e.g. PROJECT=hbase-operator-tools
51+
export PROJECT="${PROJECT:-hbase}"
52+
53+
SELF=$(cd $(dirname "$0") && pwd)
5154
. "$SELF/release-util.sh"
5255

5356
function usage {
54-
local NAME=$(basename $0)
57+
local NAME
58+
NAME="$(basename "$0")"
5559
cat <<EOF
5660
Usage: $NAME [options]
5761
5862
This script runs the release scripts inside a docker image.
5963
6064
Options:
6165
62-
-d [path] required. working directory. output will be written to "output" in here.
63-
-n dry run mode. Checks and local builds, but does not upload anything.
64-
-t [tag] tag for the hbase-rm docker image to use for building (default: "latest").
65-
-j [path] path to local JDK installation to use building. By default the script will
66+
-d [path] required. working directory. output will be written to "output" in here.
67+
-n dry run mode. Checks and local builds, but does not upload anything.
68+
-t [tag] tag for the hbase-rm docker image to use for building (default: "latest").
69+
-j [path] path to local JDK installation to use building. By default the script will
6670
use openjdk8 installed in the docker image.
67-
-s [step] runs a single step of the process; valid steps are: tag, build, publish. if
71+
-p [project] project to build; default 'hbase'; alternatively, 'hbase-thirdparty', etc.
72+
-s [step] runs a single step of the process; valid steps are: tag, build, publish. if
6873
none specified, runs tag, then build, and then publish.
6974
EOF
7075
}
@@ -73,12 +78,13 @@ WORKDIR=
7378
IMGTAG=latest
7479
JAVA=
7580
RELEASE_STEP=
76-
while getopts "d:hj:ns:t:" opt; do
81+
while getopts "d:hj:np:s:t:" opt; do
7782
case $opt in
7883
d) WORKDIR="$OPTARG" ;;
7984
n) DRY_RUN=1 ;;
8085
t) IMGTAG="$OPTARG" ;;
8186
j) JAVA="$OPTARG" ;;
87+
p) PROJECT="$OPTARG" ;;
8288
s) RELEASE_STEP="$OPTARG" ;;
8389
h) usage ;;
8490
?) error "Invalid option. Run with -h for help." ;;
@@ -90,7 +96,7 @@ if [ -z "$WORKDIR" ] || [ ! -d "$WORKDIR" ]; then
9096
fi
9197

9298
if [ -d "$WORKDIR/output" ]; then
93-
read -p "Output directory already exists. Overwrite and continue? [y/n] " ANSWER
99+
read -r -p "Output directory already exists. Overwrite and continue? [y/n] " ANSWER
94100
if [ "$ANSWER" != "y" ]; then
95101
error "Exiting."
96102
fi
@@ -112,7 +118,7 @@ done
112118

113119
GPG_KEY_FILE="$WORKDIR/gpg.key"
114120
fcreate_secure "$GPG_KEY_FILE"
115-
$GPG --passphrase $GPG_PASSPHRASE --export-secret-key --armor "$GPG_KEY" > "$GPG_KEY_FILE"
121+
$GPG --passphrase "$GPG_PASSPHRASE" --export-secret-key --armor "$GPG_KEY" > "$GPG_KEY_FILE"
116122

117123
run_silent "Building hbase-rm image with tag $IMGTAG..." "docker-build.log" \
118124
docker build -t "hbase-rm:$IMGTAG" --build-arg UID=$UID "$SELF/hbase-rm"
@@ -129,7 +135,7 @@ function cleanup {
129135

130136
trap cleanup EXIT
131137

132-
cat > $ENVFILE <<EOF
138+
cat > "$ENVFILE" <<EOF
133139
DRY_RUN=$DRY_RUN
134140
SKIP_TAG=$SKIP_TAG
135141
RUNNING_IN_DOCKER=1
@@ -138,7 +144,7 @@ NEXT_VERSION=$NEXT_VERSION
138144
RELEASE_VERSION=$RELEASE_VERSION
139145
RELEASE_TAG=$RELEASE_TAG
140146
GIT_REF=$GIT_REF
141-
HBASE_PACKAGE_VERSION=$HBASE_PACKAGE_VERSION
147+
PACKAGE_VERSION=$PACKAGE_VERSION
142148
ASF_USERNAME=$ASF_USERNAME
143149
GIT_NAME=$GIT_NAME
144150
GIT_EMAIL=$GIT_EMAIL
@@ -152,7 +158,7 @@ EOF
152158

153159
JAVA_VOL=
154160
if [ -n "$JAVA" ]; then
155-
echo "JAVA_HOME=/opt/hbase-java" >> $ENVFILE
161+
echo "JAVA_HOME=/opt/hbase-java" >> "$ENVFILE"
156162
JAVA_VOL="--volume $JAVA:/opt/hbase-java"
157163
fi
158164

dev-support/create-release/do-release.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717
# limitations under the License.
1818
#
1919

20-
# Called by do-release-docker.sh. Can be run standalone but needs some love
21-
# for it to work smooth.
20+
# Use the adjacent do-release-docker.sh instead, if you can.
21+
# Otherwise, this runs core of the release creation.
22+
# Will ask you questions on what to build and for logins
23+
# and passwords to use building.
24+
export PROJECT="${PROJECT:-hbase}"
25+
2226
SELF=$(cd $(dirname $0) && pwd)
2327
. "$SELF/release-util.sh"
2428

@@ -30,6 +34,7 @@ while getopts "bn" opt; do
3034
esac
3135
done
3236

37+
# If running in docker, import and then cache keys.
3338
if [ "$RUNNING_IN_DOCKER" = "1" ]; then
3439
# Run gpg agent.
3540
eval $(gpg-agent --disable-scdaemon --daemon --no-grab --allow-preset-passphrase --default-cache-ttl=86400 --max-cache-ttl=86400)
@@ -66,7 +71,7 @@ else
6671
fi
6772

6873
if should_build "build"; then
69-
run_silent "Building HBase..." "build.log" \
74+
run_silent "Building ${PROJECT}..." "build.log" \
7075
"$SELF/release-build.sh" build
7176
else
7277
echo "Skipping build step."

0 commit comments

Comments
 (0)