buildscripts: sonatype uploader ussing CONF before it is set (#4388)

Set $CONF before we use it.
Also enable some defensive bash flags to catch errors.
Default value for USER and PASS
This commit is contained in:
zpencer 2018-04-25 12:54:49 -07:00 committed by GitHub
parent 6bdf5de342
commit 7cd2f5c3c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
set -eu -o pipefail
if [ $# -ne 2 ]; then
cat <<EOF
@ -46,8 +46,12 @@ if [ -z "$DIR" ]; then
exit 1
fi
CONF="$HOME/.config/sonatype-upload"
[ -f "$CONF" ] && . "$CONF"
USERNAME="${USERNAME:-}"
PASSWORD="${PASSWORD:-}"
if [ -z "$USERNAME" -o -z "$PASSWORD" ]; then
# TODO(ejona86): if people would use it, could prompt for values to avoid
# having passwords in plain-text.
@ -55,7 +59,6 @@ if [ -z "$USERNAME" -o -z "$PASSWORD" ]; then
exit 1
fi
CONF="$HOME/.config/sonatype-upload"
STAGING_URL="https://oss.sonatype.org/service/local/staging"
# We go through the effort of using deloyByRepositoryId/ because it is