You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2025/05/16 03:04:59 UTC

(spark) branch branch-3.5 updated: [SPARK-52178][BUILD] Make release scripts to respect SKIP_TAG and ANSWER when already set with DEBUG_MODE

This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch branch-3.5
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.5 by this push:
     new 5b8b75a8624e [SPARK-52178][BUILD] Make release scripts to respect SKIP_TAG and ANSWER when already set with DEBUG_MODE
5b8b75a8624e is described below

commit 5b8b75a8624e6bbf699d97e617cc83b00f3a6909
Author: Hyukjin Kwon <gu...@apache.org>
AuthorDate: Fri May 16 12:04:27 2025 +0900

    [SPARK-52178][BUILD] Make release scripts to respect SKIP_TAG and ANSWER when already set with DEBUG_MODE
    
    ### What changes were proposed in this pull request?
    
    This PR proposes:
    - Respect `SKIP_TAG` and `ANSWER` if they are already set in the release scripts.
    - Add `DEBUG_MODE` which fails fast and print out the commands that this script runs
    
    ### Why are the changes needed?
    
    In order to make the release easier without interactions in the middle of builds.
    Also this is a part of release automation in https://github.com/apache/spark/pull/50884.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No, dev-only.
    
    ### How was this patch tested?
    
    Tested in https://github.com/HyukjinKwon/spark/actions/runs/15059178395/job/42330938218
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #50909 from HyukjinKwon/SPARK-52175.
    
    Authored-by: Hyukjin Kwon <gu...@apache.org>
    Signed-off-by: Hyukjin Kwon <gu...@apache.org>
    (cherry picked from commit d7d8b243c7d7c787b335ec83e9de4112a6b3294c)
    Signed-off-by: Hyukjin Kwon <gu...@apache.org>
---
 dev/create-release/do-release-docker.sh |  9 +++++++--
 dev/create-release/release-util.sh      | 20 +++++++++++++++-----
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/dev/create-release/do-release-docker.sh b/dev/create-release/do-release-docker.sh
index ea3105b3d0a7..1448fefa5663 100755
--- a/dev/create-release/do-release-docker.sh
+++ b/dev/create-release/do-release-docker.sh
@@ -71,7 +71,9 @@ if [ -z "$WORKDIR" ] || [ ! -d "$WORKDIR" ]; then
 fi
 
 if [ -d "$WORKDIR/output" ]; then
-  read -p "Output directory already exists. Overwrite and continue? [y/n] " ANSWER
+  if [ -z "$ANSWER" ]; then
+    read -p "Output directory already exists. Overwrite and continue? [y/n] " ANSWER
+  fi
   if [ "$ANSWER" != "y" ]; then
     error "Exiting."
   fi
@@ -79,7 +81,9 @@ fi
 
 if [ ! -z "$RELEASE_STEP" ] && [ "$RELEASE_STEP" = "finalize" ]; then
   echo "THIS STEP IS IRREVERSIBLE! Make sure the vote has passed and you pick the right RC to finalize."
-  read -p "You must be a PMC member to run this step. Continue? [y/n] " ANSWER
+  if [ -z "$ANSWER" ]; then
+    read -p "You must be a PMC member to run this step. Continue? [y/n] " ANSWER
+  fi
   if [ "$ANSWER" != "y" ]; then
     error "Exiting."
   fi
@@ -146,6 +150,7 @@ PYPI_API_TOKEN=$PYPI_API_TOKEN
 GPG_PASSPHRASE=$GPG_PASSPHRASE
 RELEASE_STEP=$RELEASE_STEP
 USER=$USER
+DEBUG_MODE=$DEBUG_MODE
 EOF
 
 JAVA_VOL=
diff --git a/dev/create-release/release-util.sh b/dev/create-release/release-util.sh
index 0394fb49c2fa..dcef8e8c2260 100755
--- a/dev/create-release/release-util.sh
+++ b/dev/create-release/release-util.sh
@@ -16,6 +16,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+if [[ $DEBUG_MODE = 1 ]]; then
+  # Fail fast and print out commands it runs.
+  set -o pipefail
+  set -e
+  set -x
+fi
 
 DRY_RUN=${DRY_RUN:-0}
 GPG="gpg --no-tty --batch"
@@ -135,9 +141,11 @@ function get_release_info {
 
   # Check if the RC already exists, and if re-creating the RC, skip tag creation.
   RELEASE_TAG="v${RELEASE_VERSION}-rc${RC_COUNT}"
-  SKIP_TAG=0
-  if check_for_tag "$RELEASE_TAG"; then
-    read -p "$RELEASE_TAG already exists. Continue anyway [y/n]? " ANSWER
+  SKIP_TAG="${SKIP_TAG:-0}"
+  if check_for_tag "$RELEASE_TAG" && [[ $SKIP_TAG = 0 ]]; then
+    if [ -z "$ANSWER" ]; then
+      read -p "$RELEASE_TAG already exists. Continue anyway [y/n]? " ANSWER
+    fi
     if [ "$ANSWER" != "y" ]; then
       error "Exiting."
     fi
@@ -150,7 +158,7 @@ function get_release_info {
   GIT_REF="$RELEASE_TAG"
   if is_dry_run; then
     echo "This is a dry run. Please confirm the ref that will be built for testing."
-    if [[ $SKIP_TAG = 0 ]]; then
+    if [[ $SKIP_TAG = 1 ]]; then
       GIT_REF="$GIT_BRANCH"
     fi
     GIT_REF=$(read_config "Ref" "$GIT_REF")
@@ -186,7 +194,9 @@ E-MAIL:     $GIT_EMAIL
 ================
 EOF
 
-  read -p "Is this info correct [y/n]? " ANSWER
+  if [ -z "$ANSWER" ]; then
+    read -p "Is this info correct [y/n]? " ANSWER
+  fi
   if [ "$ANSWER" != "y" ]; then
     echo "Exiting."
     exit 1


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org