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

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


The following commit(s) were added to refs/heads/master by this push:
     new 20cd4ad8167e [SPARK-52453][BUILD] Automatically release and drop 
artifacts in Apache Nexus repository
20cd4ad8167e is described below

commit 20cd4ad8167e86fbf01eec36acbab6551669d21e
Author: Hyukjin Kwon <gurwls...@apache.org>
AuthorDate: Thu Jun 12 04:50:15 2025 -0700

    [SPARK-52453][BUILD] Automatically release and drop artifacts in Apache 
Nexus repository
    
    ### What changes were proposed in this pull request?
    
    This PR proposes to automatically release and drop artifacts in Apache 
Nexus repository when the vote passes for an RC.
    
    ### Why are the changes needed?
    
    To automate the release.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No, dev-only.
    
    ### How was this patch tested?
    
    I manually tested some set of commands but not tested it with the actual 
release yet. We need to test it later in the official release later.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #51159 from HyukjinKwon/SPARK-52453.
    
    Authored-by: Hyukjin Kwon <gurwls...@apache.org>
    Signed-off-by: Hyukjin Kwon <gurwls...@apache.org>
---
 dev/create-release/release-build.sh | 50 +++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/dev/create-release/release-build.sh 
b/dev/create-release/release-build.sh
index 67d6d9510598..1245b414fb0c 100755
--- a/dev/create-release/release-build.sh
+++ b/dev/create-release/release-build.sh
@@ -180,6 +180,56 @@ if [[ "$1" == "finalize" ]]; then
   echo "KEYS sync'ed"
   rm -rf svn-spark
 
+  # TODO: Test it in the actual release
+  # Release artifacts in the Nexus repository
+  # Find latest orgapachespark-* repo for this release version
+  REPO_ID=$(curl --retry 10 --retry-all-errors -s -u 
"$ASF_USERNAME:$ASF_PASSWORD" \
+    https://repository.apache.org/service/local/staging/profile_repositories | 
\
+    grep -A 5 "<repositoryId>orgapachespark-" | \
+    awk '/<repositoryId>/ { id = $0 } /<description>/ && $0 ~ /Apache Spark 
'"$RELEASE_VERSION"'/ { print id }' | \
+    grep -oP '(?<=<repositoryId>)orgapachespark-[0-9]+(?=</repositoryId>)' | \
+    sort -V | tail -n 1)
+
+  if [[ -z "$REPO_ID" ]]; then
+    echo "No matching staging repository found for Apache Spark 
$RELEASE_VERSION"
+    exit 1
+  fi
+
+  echo "Using repository ID: $REPO_ID"
+
+  # Release the repository
+  curl --retry 10 --retry-all-errors -s -u "$APACHE_USERNAME:$APACHE_PASSWORD" 
\
+    -H "Content-Type: application/json" \
+    -X POST https://repository.apache.org/service/local/staging/bulk/promote \
+    -d "{\"data\": {\"stagedRepositoryIds\": [\"$REPO_ID\"], \"description\": 
\"Apache Spark $RELEASE_VERSION\"}}"
+
+  # Wait for release to complete
+  echo "Waiting for release to complete..."
+  while true; do
+    STATUS=$(curl --retry 10 --retry-all-errors -s -u 
"$APACHE_USERNAME:$APACHE_PASSWORD" \
+      https://repository.apache.org/service/local/staging/repository/$REPO_ID 
| \
+      grep -oPm1 "(?<=<type>)[^<]+")
+    echo "Current state: $STATUS"
+    if [[ "$STATUS" == "released" ]]; then
+      echo "Release complete."
+      break
+    elif [[ "$STATUS" == "release_failed" || "$STATUS" == "error" ]]; then
+      echo "Release failed."
+      exit 1
+    elif [[ "$STATUS" == "open" ]]; then
+      echo "Repository is still open. Cannot release. Please close it first."
+      exit 1
+    fi
+    sleep 10
+  done
+
+  # Drop the repository after release
+  curl --retry 10 --retry-all-errors -s -u "$APACHE_USERNAME:$APACHE_PASSWORD" 
\
+    -H "Content-Type: application/json" \
+    -X POST https://repository.apache.org/service/local/staging/bulk/drop \
+    -d "{\"data\": {\"stagedRepositoryIds\": [\"$REPO_ID\"], \"description\": 
\"Dropped after release\"}}"
+
+  echo "Done."
   exit 0
 fi
 


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

Reply via email to