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
4746# 1. https://github.com/apache/spark/tree/master/dev/create-release
4847#
4948set -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
5356function usage {
54- local NAME=$( basename $0 )
57+ local NAME
58+ NAME=" $( basename " $0 " ) "
5559 cat << EOF
5660Usage: $NAME [options]
5761
5862This script runs the release scripts inside a docker image.
5963
6064Options:
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.
6974EOF
7075}
@@ -73,12 +78,13 @@ WORKDIR=
7378IMGTAG=latest
7479JAVA=
7580RELEASE_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
9096fi
9197
9298if [ -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
112118
113119GPG_KEY_FILE=" $WORKDIR /gpg.key"
114120fcreate_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
117123run_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
130136trap cleanup EXIT
131137
132- cat > $ENVFILE << EOF
138+ cat > " $ENVFILE " << EOF
133139DRY_RUN=$DRY_RUN
134140SKIP_TAG=$SKIP_TAG
135141RUNNING_IN_DOCKER=1
@@ -138,7 +144,7 @@ NEXT_VERSION=$NEXT_VERSION
138144RELEASE_VERSION=$RELEASE_VERSION
139145RELEASE_TAG=$RELEASE_TAG
140146GIT_REF=$GIT_REF
141- HBASE_PACKAGE_VERSION= $HBASE_PACKAGE_VERSION
147+ PACKAGE_VERSION= $PACKAGE_VERSION
142148ASF_USERNAME=$ASF_USERNAME
143149GIT_NAME=$GIT_NAME
144150GIT_EMAIL=$GIT_EMAIL
152158
153159JAVA_VOL=
154160if [ -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"
157163fi
158164
0 commit comments