You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/05/10 18:27:18 UTC

[GitHub] [solr] sonatype-lift[bot] commented on a diff in pull request #807: Add script to upload maven artifacts during release

sonatype-lift[bot] commented on code in PR #807:
URL: https://github.com/apache/solr/pull/807#discussion_r869557757


##########
dev-tools/scripts/upload-maven.sh:
##########
@@ -0,0 +1,157 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Functionality forked and adapted from https://github.com/apache/spark/blob/v3.2.1/dev/create-release/release-build.sh - Apache license
+
+function LOG() {
+  local STATUS=$1
+  local MESSAGE=$2
+  echo ""
+  echo "[$(date)] ${STATUS} ${MESSAGE}"
+}
+
+function usage() {
+  cat << EOF
+Usage: dev-tools/scripts/upload-maven.sh [<options>]
+ -v    The version of Solr
+ -c    The commit hash for this version of Solr
+ -d    Directory where the maven artifacts to upload live.
+ -u    ASF Username
+
+If "ASF_PASSWORD" is not set, you will be prompted for your password.
+
+Example:
+  dev-tools/scripts/upload-maven.sh -v 9.0.0 -c asdf23 -d /tmp/release-candidate/maven -u houston
+EOF
+}
+
+while getopts ":hv:c:d:u:" opt; do
+  case ${opt} in
+    v)
+      SOLR_VERSION="$OPTARG"
+      ;;
+    c)
+      COMMIT_HASH="$OPTARG"
+      ;;
+    d)
+      MAVEN_DIRECTORY="$OPTARG"
+      ;;
+    u)
+      ASF_USERNAME="$OPTARG"
+      ;;
+    h)
+      usage
+      exit 0
+      ;;
+   \?)
+      echo "Unknown option $OPTARG"
+      usage
+      exit 1
+   esac
+done
+shift $((OPTIND -1))
+
+if [[ -z "$SOLR_VERSION" ]]; then
+  LOG ERROR "Lacking -v option, must specify Solr version."
+  usage
+  exit 1
+fi
+
+if [[ -z "$COMMIT_HASH" ]]; then
+  LOG ERROR "Lacking -c option, must specify Commit Hash."
+  usage
+  exit 1
+fi
+
+if [[ -z "$MAVEN_DIRECTORY" ]]; then
+  LOG ERROR "Lacking -d option, must specify directory where maven artifacts live."
+  usage
+  exit 1
+fi
+
+if [[ -z "$ASF_USERNAME" ]]; then
+  LOG ERROR 'Lacking -u option or ASF_USERNAME envVar, must specify ASF Username to upload artifacts.'
+  usage
+  exit 1
+fi
+
+if [[ -z "$ASF_PASSWORD" ]]; then
+  LOG INFO 'The environment variable ASF_PASSWORD is not set.'
+  stty -echo
+  echo ""
+  echo "Please provide ${ASF_USERNAME}'s ASF Password:"
+  read ASF_PASSWORD

Review Comment:
   *[SC2162](https://github.com/koalaman/shellcheck/wiki/SC2162):*  read without -r will mangle backslashes.
   
   (at-me [in a reply](https://help.sonatype.com/lift/talking-to-lift) with `help` or `ignore`)
   
   ---
   
   Was this a good recommendation?
   [ [🙁 Not relevant](https://www.sonatype.com/lift-comment-rating?comment=206964126&lift_comment_rating=1) ] - [ [😕 Won't fix](https://www.sonatype.com/lift-comment-rating?comment=206964126&lift_comment_rating=2) ] - [ [😑 Not critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=206964126&lift_comment_rating=3) ] - [ [🙂 Critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=206964126&lift_comment_rating=4) ] - [ [😊 Critical, fixing now](https://www.sonatype.com/lift-comment-rating?comment=206964126&lift_comment_rating=5) ]



##########
dev-tools/scripts/upload-maven.sh:
##########
@@ -0,0 +1,157 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Functionality forked and adapted from https://github.com/apache/spark/blob/v3.2.1/dev/create-release/release-build.sh - Apache license
+
+function LOG() {
+  local STATUS=$1
+  local MESSAGE=$2
+  echo ""
+  echo "[$(date)] ${STATUS} ${MESSAGE}"
+}
+
+function usage() {
+  cat << EOF
+Usage: dev-tools/scripts/upload-maven.sh [<options>]
+ -v    The version of Solr
+ -c    The commit hash for this version of Solr
+ -d    Directory where the maven artifacts to upload live.
+ -u    ASF Username
+
+If "ASF_PASSWORD" is not set, you will be prompted for your password.
+
+Example:
+  dev-tools/scripts/upload-maven.sh -v 9.0.0 -c asdf23 -d /tmp/release-candidate/maven -u houston
+EOF
+}
+
+while getopts ":hv:c:d:u:" opt; do
+  case ${opt} in
+    v)
+      SOLR_VERSION="$OPTARG"
+      ;;
+    c)
+      COMMIT_HASH="$OPTARG"
+      ;;
+    d)
+      MAVEN_DIRECTORY="$OPTARG"
+      ;;
+    u)
+      ASF_USERNAME="$OPTARG"
+      ;;
+    h)
+      usage
+      exit 0
+      ;;
+   \?)
+      echo "Unknown option $OPTARG"
+      usage
+      exit 1
+   esac
+done
+shift $((OPTIND -1))
+
+if [[ -z "$SOLR_VERSION" ]]; then
+  LOG ERROR "Lacking -v option, must specify Solr version."
+  usage
+  exit 1
+fi
+
+if [[ -z "$COMMIT_HASH" ]]; then
+  LOG ERROR "Lacking -c option, must specify Commit Hash."
+  usage
+  exit 1
+fi
+
+if [[ -z "$MAVEN_DIRECTORY" ]]; then
+  LOG ERROR "Lacking -d option, must specify directory where maven artifacts live."
+  usage
+  exit 1
+fi
+
+if [[ -z "$ASF_USERNAME" ]]; then
+  LOG ERROR 'Lacking -u option or ASF_USERNAME envVar, must specify ASF Username to upload artifacts.'
+  usage
+  exit 1
+fi
+
+if [[ -z "$ASF_PASSWORD" ]]; then
+  LOG INFO 'The environment variable ASF_PASSWORD is not set.'
+  stty -echo
+  echo ""
+  echo "Please provide ${ASF_USERNAME}'s ASF Password:"
+  read ASF_PASSWORD
+  stty echo
+  printf "\n"
+fi
+
+NEXUS_ROOT=https://repository.apache.org/service/local/staging
+NEXUS_PROFILE=4bfe5196a41e63 # Profile for Solr staging uploads
+
+# Using Nexus API documented here:
+# https://support.sonatype.com/entries/39720203-Uploading-to-a-Staging-Repository-via-REST-API
+
+function create_staging_repo() {
+  repo_request="<promoteRequest><data><description>Apache Solr $SOLR_VERSION (commit $COMMIT_HASH)</description></data></promoteRequest>"
+  out=$(curl -X POST -d "$repo_request" -u "$ASF_USERNAME:$ASF_PASSWORD" \
+    -H "Content-Type:application/xml" -v \
+    "$NEXUS_ROOT/profiles/$NEXUS_PROFILE/start")
+  staged_repo_id=$(echo $out | sed -e "s/.*\(orgapachesolr-[0-9]\{4\}\).*/\1/")

Review Comment:
   *[SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086):*  Double quote to prevent globbing and word splitting.
   
   (at-me [in a reply](https://help.sonatype.com/lift/talking-to-lift) with `help` or `ignore`)
   
   ---
   
   Was this a good recommendation?
   [ [🙁 Not relevant](https://www.sonatype.com/lift-comment-rating?comment=206964130&lift_comment_rating=1) ] - [ [😕 Won't fix](https://www.sonatype.com/lift-comment-rating?comment=206964130&lift_comment_rating=2) ] - [ [😑 Not critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=206964130&lift_comment_rating=3) ] - [ [🙂 Critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=206964130&lift_comment_rating=4) ] - [ [😊 Critical, fixing now](https://www.sonatype.com/lift-comment-rating?comment=206964130&lift_comment_rating=5) ]



##########
dev-tools/scripts/upload-maven.sh:
##########
@@ -0,0 +1,157 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Functionality forked and adapted from https://github.com/apache/spark/blob/v3.2.1/dev/create-release/release-build.sh - Apache license
+
+function LOG() {
+  local STATUS=$1
+  local MESSAGE=$2
+  echo ""
+  echo "[$(date)] ${STATUS} ${MESSAGE}"
+}
+
+function usage() {
+  cat << EOF
+Usage: dev-tools/scripts/upload-maven.sh [<options>]
+ -v    The version of Solr
+ -c    The commit hash for this version of Solr
+ -d    Directory where the maven artifacts to upload live.
+ -u    ASF Username
+
+If "ASF_PASSWORD" is not set, you will be prompted for your password.
+
+Example:
+  dev-tools/scripts/upload-maven.sh -v 9.0.0 -c asdf23 -d /tmp/release-candidate/maven -u houston
+EOF
+}
+
+while getopts ":hv:c:d:u:" opt; do
+  case ${opt} in
+    v)
+      SOLR_VERSION="$OPTARG"
+      ;;
+    c)
+      COMMIT_HASH="$OPTARG"
+      ;;
+    d)
+      MAVEN_DIRECTORY="$OPTARG"
+      ;;
+    u)
+      ASF_USERNAME="$OPTARG"
+      ;;
+    h)
+      usage
+      exit 0
+      ;;
+   \?)
+      echo "Unknown option $OPTARG"
+      usage
+      exit 1
+   esac
+done
+shift $((OPTIND -1))
+
+if [[ -z "$SOLR_VERSION" ]]; then
+  LOG ERROR "Lacking -v option, must specify Solr version."
+  usage
+  exit 1
+fi
+
+if [[ -z "$COMMIT_HASH" ]]; then
+  LOG ERROR "Lacking -c option, must specify Commit Hash."
+  usage
+  exit 1
+fi
+
+if [[ -z "$MAVEN_DIRECTORY" ]]; then
+  LOG ERROR "Lacking -d option, must specify directory where maven artifacts live."
+  usage
+  exit 1
+fi
+
+if [[ -z "$ASF_USERNAME" ]]; then
+  LOG ERROR 'Lacking -u option or ASF_USERNAME envVar, must specify ASF Username to upload artifacts.'
+  usage
+  exit 1
+fi
+
+if [[ -z "$ASF_PASSWORD" ]]; then
+  LOG INFO 'The environment variable ASF_PASSWORD is not set.'
+  stty -echo
+  echo ""
+  echo "Please provide ${ASF_USERNAME}'s ASF Password:"
+  read ASF_PASSWORD
+  stty echo
+  printf "\n"
+fi
+
+NEXUS_ROOT=https://repository.apache.org/service/local/staging
+NEXUS_PROFILE=4bfe5196a41e63 # Profile for Solr staging uploads
+
+# Using Nexus API documented here:
+# https://support.sonatype.com/entries/39720203-Uploading-to-a-Staging-Repository-via-REST-API
+
+function create_staging_repo() {
+  repo_request="<promoteRequest><data><description>Apache Solr $SOLR_VERSION (commit $COMMIT_HASH)</description></data></promoteRequest>"
+  out=$(curl -X POST -d "$repo_request" -u "$ASF_USERNAME:$ASF_PASSWORD" \
+    -H "Content-Type:application/xml" -v \
+    "$NEXUS_ROOT/profiles/$NEXUS_PROFILE/start")
+  staged_repo_id=$(echo $out | sed -e "s/.*\(orgapachesolr-[0-9]\{4\}\).*/\1/")
+  echo "$staged_repo_id"
+}
+
+function finalize_staging_repo() {
+  STAGING_REPO_ID=$1
+  repo_request="<promoteRequest><data><stagedRepositoryId>$STAGING_REPO_ID</stagedRepositoryId><description>Apache Solr $SOLR_VERSION (commit $COMMIT_HASH)</description></data></promoteRequest>"
+      out=$(curl -X POST -d "$repo_request" -u "$ASF_USERNAME:$ASF_PASSWORD" \
+        -H "Content-Type:application/xml" -v \
+        "$NEXUS_ROOT/profiles/$NEXUS_PROFILE/finish")
+}
+
+LOG "INFO" "Creating Nexus staging repository"
+printf "\n\n"
+STAGING_REPO_ID="$(create_staging_repo)"
+if [[ -z "$STAGING_REPO_ID" ]]; then
+  LOG ERROR "Error creating staging repo, please debug using the curl output logged above."
+  exit 1
+fi
+LOG "INFO"  "Staging repo created with id: ${STAGING_REPO_ID}"
+
+printf "\n\n"
+LOG "INFO" "Uploading files to Nexus staging repository"
+printf "\n\n"
+(
+  cd "${MAVEN_DIRECTORY}"
+
+  NEXUS_FILE_UPLOAD_URL="$NEXUS_ROOT/deployByRepositoryId/$STAGING_REPO_ID"
+  for file in $(find . -type f); do

Review Comment:
   *[SC2044](https://github.com/koalaman/shellcheck/wiki/SC2044):*  For loops over find output are fragile. Use find -exec or a while read loop.
   
   (at-me [in a reply](https://help.sonatype.com/lift/talking-to-lift) with `help` or `ignore`)
   
   ---
   
   Was this a good recommendation?
   [ [🙁 Not relevant](https://www.sonatype.com/lift-comment-rating?comment=206964132&lift_comment_rating=1) ] - [ [😕 Won't fix](https://www.sonatype.com/lift-comment-rating?comment=206964132&lift_comment_rating=2) ] - [ [😑 Not critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=206964132&lift_comment_rating=3) ] - [ [🙂 Critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=206964132&lift_comment_rating=4) ] - [ [😊 Critical, fixing now](https://www.sonatype.com/lift-comment-rating?comment=206964132&lift_comment_rating=5) ]



##########
dev-tools/scripts/upload-maven.sh:
##########
@@ -0,0 +1,157 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Functionality forked and adapted from https://github.com/apache/spark/blob/v3.2.1/dev/create-release/release-build.sh - Apache license
+
+function LOG() {
+  local STATUS=$1
+  local MESSAGE=$2
+  echo ""
+  echo "[$(date)] ${STATUS} ${MESSAGE}"
+}
+
+function usage() {
+  cat << EOF
+Usage: dev-tools/scripts/upload-maven.sh [<options>]
+ -v    The version of Solr
+ -c    The commit hash for this version of Solr
+ -d    Directory where the maven artifacts to upload live.
+ -u    ASF Username
+
+If "ASF_PASSWORD" is not set, you will be prompted for your password.
+
+Example:
+  dev-tools/scripts/upload-maven.sh -v 9.0.0 -c asdf23 -d /tmp/release-candidate/maven -u houston
+EOF
+}
+
+while getopts ":hv:c:d:u:" opt; do
+  case ${opt} in
+    v)
+      SOLR_VERSION="$OPTARG"
+      ;;
+    c)
+      COMMIT_HASH="$OPTARG"
+      ;;
+    d)
+      MAVEN_DIRECTORY="$OPTARG"
+      ;;
+    u)
+      ASF_USERNAME="$OPTARG"
+      ;;
+    h)
+      usage
+      exit 0
+      ;;
+   \?)
+      echo "Unknown option $OPTARG"
+      usage
+      exit 1
+   esac
+done
+shift $((OPTIND -1))
+
+if [[ -z "$SOLR_VERSION" ]]; then
+  LOG ERROR "Lacking -v option, must specify Solr version."
+  usage
+  exit 1
+fi
+
+if [[ -z "$COMMIT_HASH" ]]; then
+  LOG ERROR "Lacking -c option, must specify Commit Hash."
+  usage
+  exit 1
+fi
+
+if [[ -z "$MAVEN_DIRECTORY" ]]; then
+  LOG ERROR "Lacking -d option, must specify directory where maven artifacts live."
+  usage
+  exit 1
+fi
+
+if [[ -z "$ASF_USERNAME" ]]; then
+  LOG ERROR 'Lacking -u option or ASF_USERNAME envVar, must specify ASF Username to upload artifacts.'
+  usage
+  exit 1
+fi
+
+if [[ -z "$ASF_PASSWORD" ]]; then
+  LOG INFO 'The environment variable ASF_PASSWORD is not set.'
+  stty -echo
+  echo ""
+  echo "Please provide ${ASF_USERNAME}'s ASF Password:"
+  read ASF_PASSWORD
+  stty echo
+  printf "\n"
+fi
+
+NEXUS_ROOT=https://repository.apache.org/service/local/staging
+NEXUS_PROFILE=4bfe5196a41e63 # Profile for Solr staging uploads
+
+# Using Nexus API documented here:
+# https://support.sonatype.com/entries/39720203-Uploading-to-a-Staging-Repository-via-REST-API
+
+function create_staging_repo() {
+  repo_request="<promoteRequest><data><description>Apache Solr $SOLR_VERSION (commit $COMMIT_HASH)</description></data></promoteRequest>"
+  out=$(curl -X POST -d "$repo_request" -u "$ASF_USERNAME:$ASF_PASSWORD" \
+    -H "Content-Type:application/xml" -v \
+    "$NEXUS_ROOT/profiles/$NEXUS_PROFILE/start")
+  staged_repo_id=$(echo $out | sed -e "s/.*\(orgapachesolr-[0-9]\{4\}\).*/\1/")

Review Comment:
   *[SC2001](https://github.com/koalaman/shellcheck/wiki/SC2001):*  See if you can use ${variable//search/replace} instead.
   
   (at-me [in a reply](https://help.sonatype.com/lift/talking-to-lift) with `help` or `ignore`)
   
   ---
   
   Was this a good recommendation?
   [ [🙁 Not relevant](https://www.sonatype.com/lift-comment-rating?comment=206964128&lift_comment_rating=1) ] - [ [😕 Won't fix](https://www.sonatype.com/lift-comment-rating?comment=206964128&lift_comment_rating=2) ] - [ [😑 Not critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=206964128&lift_comment_rating=3) ] - [ [🙂 Critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=206964128&lift_comment_rating=4) ] - [ [😊 Critical, fixing now](https://www.sonatype.com/lift-comment-rating?comment=206964128&lift_comment_rating=5) ]



##########
dev-tools/scripts/upload-maven.sh:
##########
@@ -0,0 +1,157 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Functionality forked and adapted from https://github.com/apache/spark/blob/v3.2.1/dev/create-release/release-build.sh - Apache license
+
+function LOG() {
+  local STATUS=$1
+  local MESSAGE=$2
+  echo ""
+  echo "[$(date)] ${STATUS} ${MESSAGE}"
+}
+
+function usage() {
+  cat << EOF
+Usage: dev-tools/scripts/upload-maven.sh [<options>]
+ -v    The version of Solr
+ -c    The commit hash for this version of Solr
+ -d    Directory where the maven artifacts to upload live.
+ -u    ASF Username
+
+If "ASF_PASSWORD" is not set, you will be prompted for your password.
+
+Example:
+  dev-tools/scripts/upload-maven.sh -v 9.0.0 -c asdf23 -d /tmp/release-candidate/maven -u houston
+EOF
+}
+
+while getopts ":hv:c:d:u:" opt; do
+  case ${opt} in
+    v)
+      SOLR_VERSION="$OPTARG"
+      ;;
+    c)
+      COMMIT_HASH="$OPTARG"
+      ;;
+    d)
+      MAVEN_DIRECTORY="$OPTARG"
+      ;;
+    u)
+      ASF_USERNAME="$OPTARG"
+      ;;
+    h)
+      usage
+      exit 0
+      ;;
+   \?)
+      echo "Unknown option $OPTARG"
+      usage
+      exit 1
+   esac
+done
+shift $((OPTIND -1))
+
+if [[ -z "$SOLR_VERSION" ]]; then
+  LOG ERROR "Lacking -v option, must specify Solr version."
+  usage
+  exit 1
+fi
+
+if [[ -z "$COMMIT_HASH" ]]; then
+  LOG ERROR "Lacking -c option, must specify Commit Hash."
+  usage
+  exit 1
+fi
+
+if [[ -z "$MAVEN_DIRECTORY" ]]; then
+  LOG ERROR "Lacking -d option, must specify directory where maven artifacts live."
+  usage
+  exit 1
+fi
+
+if [[ -z "$ASF_USERNAME" ]]; then
+  LOG ERROR 'Lacking -u option or ASF_USERNAME envVar, must specify ASF Username to upload artifacts.'
+  usage
+  exit 1
+fi
+
+if [[ -z "$ASF_PASSWORD" ]]; then
+  LOG INFO 'The environment variable ASF_PASSWORD is not set.'
+  stty -echo
+  echo ""
+  echo "Please provide ${ASF_USERNAME}'s ASF Password:"
+  read ASF_PASSWORD
+  stty echo
+  printf "\n"
+fi
+
+NEXUS_ROOT=https://repository.apache.org/service/local/staging
+NEXUS_PROFILE=4bfe5196a41e63 # Profile for Solr staging uploads
+
+# Using Nexus API documented here:
+# https://support.sonatype.com/entries/39720203-Uploading-to-a-Staging-Repository-via-REST-API
+
+function create_staging_repo() {
+  repo_request="<promoteRequest><data><description>Apache Solr $SOLR_VERSION (commit $COMMIT_HASH)</description></data></promoteRequest>"
+  out=$(curl -X POST -d "$repo_request" -u "$ASF_USERNAME:$ASF_PASSWORD" \
+    -H "Content-Type:application/xml" -v \
+    "$NEXUS_ROOT/profiles/$NEXUS_PROFILE/start")
+  staged_repo_id=$(echo $out | sed -e "s/.*\(orgapachesolr-[0-9]\{4\}\).*/\1/")
+  echo "$staged_repo_id"
+}
+
+function finalize_staging_repo() {
+  STAGING_REPO_ID=$1
+  repo_request="<promoteRequest><data><stagedRepositoryId>$STAGING_REPO_ID</stagedRepositoryId><description>Apache Solr $SOLR_VERSION (commit $COMMIT_HASH)</description></data></promoteRequest>"
+      out=$(curl -X POST -d "$repo_request" -u "$ASF_USERNAME:$ASF_PASSWORD" \
+        -H "Content-Type:application/xml" -v \
+        "$NEXUS_ROOT/profiles/$NEXUS_PROFILE/finish")
+}
+
+LOG "INFO" "Creating Nexus staging repository"
+printf "\n\n"
+STAGING_REPO_ID="$(create_staging_repo)"
+if [[ -z "$STAGING_REPO_ID" ]]; then
+  LOG ERROR "Error creating staging repo, please debug using the curl output logged above."
+  exit 1
+fi
+LOG "INFO"  "Staging repo created with id: ${STAGING_REPO_ID}"
+
+printf "\n\n"
+LOG "INFO" "Uploading files to Nexus staging repository"
+printf "\n\n"
+(
+  cd "${MAVEN_DIRECTORY}"

Review Comment:
   *[SC2164](https://github.com/koalaman/shellcheck/wiki/SC2164):*  Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
   
   (at-me [in a reply](https://help.sonatype.com/lift/talking-to-lift) with `help` or `ignore`)
   
   ---
   
   Was this a good recommendation?
   [ [🙁 Not relevant](https://www.sonatype.com/lift-comment-rating?comment=206964131&lift_comment_rating=1) ] - [ [😕 Won't fix](https://www.sonatype.com/lift-comment-rating?comment=206964131&lift_comment_rating=2) ] - [ [😑 Not critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=206964131&lift_comment_rating=3) ] - [ [🙂 Critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=206964131&lift_comment_rating=4) ] - [ [😊 Critical, fixing now](https://www.sonatype.com/lift-comment-rating?comment=206964131&lift_comment_rating=5) ]



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org