This is an automated email from the ASF dual-hosted git repository.
xushiyan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hudi-rs.git
The following commit(s) were added to refs/heads/main by this push:
new 26bae2b chore: improve release scripts (#68)
26bae2b is described below
commit 26bae2bac41bc3fb83ff4f73c162c2f03f2aabac
Author: Shiyan Xu <[email protected]>
AuthorDate: Tue Jul 16 20:38:10 2024 -0500
chore: improve release scripts (#68)
---
release/create_src_release.sh | 116 ----------------------------------
release/publish_src_release.sh | 64 +++++++++++++++++++
release/upload_src_release_to_dev.sh | 117 +++++++++++++++++++++++++++++++++++
release/verify_src_release.sh | 23 ++-----
4 files changed, 187 insertions(+), 133 deletions(-)
diff --git a/release/create_src_release.sh b/release/create_src_release.sh
deleted file mode 100755
index 982ec3f..0000000
--- a/release/create_src_release.sh
+++ /dev/null
@@ -1,116 +0,0 @@
-#!/bin/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.
-#
-
-set -o errexit
-set -o nounset
-
-# check git branch
-curr_branch=$(git rev-parse --abbrev-ref HEAD)
-if [[ ! $curr_branch == release/* ]]; then
- echo "Branch does not start with 'release/'"
- exit 1
-else
- echo "❗️ On branch $curr_branch"
-fi
-
-# check release version
-hudi_version=${HUDI_VERSION}
-if [ -z "${hudi_version}" ]; then
- echo "HUDI_VERSION is not set; Please specify the target hudi version to
release, e.g., 0.1.0-rc.1"
- exit 1
-else
- echo "❗️ Releasing Hudi version $hudi_version"
-fi
-
-# check release version against git tag
-curr_tag=$(git describe --exact-match --tags)
-if [[ ! "$curr_tag" == "release-$hudi_version" ]]; then
- echo "Tag '$curr_tag' does not match with release version
release-$hudi_version"
- exit 1
-else
- echo "❗️ On tag $curr_tag"
-fi
-
-# make sure a desired key is specified
-gpg_user_id=${GPG_USER_ID}
-if [ -z "${gpg_user_id}" ]; then
- echo "GPG_USER_ID is not set; run 'gpg --list-secret-keys
--keyid-format=long' to choose a key."
- exit 1
-else
- echo "❗️ Signing using key '$gpg_user_id'"
-fi
-
-work_dir="$TMPDIR$(date +'%Y-%m-%d-%H-%M-%S')"
-hudi_src_rel_dir="$work_dir/hudi-rs-$hudi_version"
-echo ">>> Archiving branch $curr_branch to $hudi_src_rel_dir"
-mkdir -p "$hudi_src_rel_dir"
-git archive --format=tgz
--output="$hudi_src_rel_dir/hudi-rs-$hudi_version.src.tgz" "$curr_branch"
-echo "Done archiving."
-
-pushd "$hudi_src_rel_dir"
-echo ">>> Generating signature"
-for i in *.tgz; do
- echo "$i"
- gpg --local-user "$gpg_user_id" --armor --output "$i.asc" --detach-sig "$i"
-done
-echo ">>> Checking signature"
-for i in *.tgz; do
- echo "$i"
- gpg --local-user "$gpg_user_id" --verify "$i.asc" "$i"
-done
-echo ">>> Generating sha512sum"
-if [ "$(uname)" == "Darwin" ]; then
- SHASUM="shasum -a 512"
-else
- SHASUM="sha512sum"
-fi
-for i in *.tgz; do
- echo "$i"
- $SHASUM "$i" >"$i.sha512"
-done
-echo ">>> Checking sha512sum"
-for i in *.tgz; do
- echo "$i"
- $SHASUM --check "$i.sha512"
-done
-
-echo "✅ SUCCESS! Created source release at $hudi_src_rel_dir"
-for i in $(ls -a "$hudi_src_rel_dir"); do echo "|___$i"; done
-popd
-
-svn_dev_url="https://dist.apache.org/repos/dist/dev/hudi"
-svn_dir="$work_dir/svn_dev"
-echo ">>> Checking out svn dev to $svn_dir"
-svn co -q $svn_dev_url --depth=immediates "$svn_dir"
-echo ">>> Checking if the same version dir exists in svn"
-hudi_src_rel_svn_dir="$svn_dir/$(basename $hudi_src_rel_dir)"
-if [ -d $hudi_src_rel_svn_dir ]; then
- echo "❌ Version $(basename $hudi_src_rel_svn_dir) already exists!"
- exit 1
-fi
-echo ">>> Copying source release files to $svn_dir"
-cp -r "$hudi_src_rel_dir" "$svn_dir/"
-echo "✅ SUCCESS! Placed source release at $hudi_src_rel_svn_dir"
-for i in $(ls -a "$hudi_src_rel_svn_dir"); do echo "|___$i"; done
-
-echo "❗️ [ACTION REQUIRED] Manually inspect and commit the source release to
SVN."
-echo "1️⃣ cd $svn_dir"
-echo "2️⃣ svn add $(basename $hudi_src_rel_svn_dir)"
-echo "3️⃣ svn commit -m 'add $(basename $hudi_src_rel_svn_dir)'"
diff --git a/release/publish_src_release.sh b/release/publish_src_release.sh
new file mode 100755
index 0000000..f6cac73
--- /dev/null
+++ b/release/publish_src_release.sh
@@ -0,0 +1,64 @@
+#!/bin/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.
+#
+
+set -o errexit
+set -o nounset
+
+if [ "$#" -lt 1 ]; then
+ echo "❌ Insufficient arguments - please specify <hudi version>"
+ exit 1
+fi
+
+hudi_version=$1
+dist_repo_subpath=hudi-rs-$hudi_version
+
+echo "❗️ Publishing $dist_repo_subpath"
+
+work_dir="$TMPDIR$(date +'%Y-%m-%d-%H-%M-%S')"
+
+svn_dev_url="https://dist.apache.org/repos/dist/dev/hudi/$dist_repo_subpath"
+svn_dev_dir="$work_dir/$dist_repo_subpath"
+echo ">>> Checking out dev src dist to $svn_dev_dir"
+svn co -q "$svn_dev_url" "$svn_dev_dir"
+
+svn_release_url="https://dist.apache.org/repos/dist/release/hudi"
+svn_release_dir="$work_dir/svn_release"
+echo ">>> Checking out release src dist to $svn_release_dir"
+svn co -q $svn_release_url --depth=immediates "$svn_release_dir"
+echo ">>> Checking if $dist_repo_subpath already exists"
+subpath="$svn_release_dir/$dist_repo_subpath"
+if [ -d "$subpath" ]; then
+ echo "❌ Version $dist_repo_subpath already exists!"
+ exit 1
+fi
+
+echo ">>> Copying $dist_repo_subpath to $subpath"
+pushd "$svn_dev_dir"
+find . -name "$dist_repo_subpath.src.*" -exec cp '{}' "$subpath" \;
+echo "✅ SUCCESS! Placed source release at $subpath"
+for i in $(ls -a "$subpath"); do echo "|___$i"; done
+popd
+
+echo ">>> Publishing to $svn_release_url"
+pushd "$svn_release_dir"
+svn add "$dist_repo_subpath"
+svn commit -m "add $dist_repo_subpath"
+echo "✅ SUCCESS! Published $dist_repo_subpath to $svn_release_url"
+popd
diff --git a/release/upload_src_release_to_dev.sh
b/release/upload_src_release_to_dev.sh
new file mode 100755
index 0000000..240d99e
--- /dev/null
+++ b/release/upload_src_release_to_dev.sh
@@ -0,0 +1,117 @@
+#!/bin/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.
+#
+
+set -o errexit
+set -o nounset
+
+# ensure it's release branch
+curr_branch=$(git rev-parse --abbrev-ref HEAD)
+if [[ ! $curr_branch == release/* ]]; then
+ echo "Branch does not start with 'release/'"
+ exit 1
+else
+ echo "❗️ On branch $curr_branch"
+fi
+
+if [ "$#" -lt 2 ]; then
+ echo "❌ Insufficient arguments - please specify <hudi version> <gpg key to
sign>"
+ echo "Run 'gpg --list-secret-keys --keyid-format=long' to choose a signing
key."
+ exit 1
+fi
+
+hudi_version=$1
+signing_key=$2
+repo=dev
+
+echo "❗️ Releasing Hudi version $hudi_version"
+echo "❗️ Uploading to https://dist.apache.org/repos/dist/$repo/hudi/"
+echo "❗️ Using signing key: $signing_key"
+
+# ensure the git tag is matched with the releasing version
+curr_tag=$(git describe --exact-match --tags)
+if [[ ! "$curr_tag" == "release-$hudi_version" ]]; then
+ echo "❌ Tag $curr_tag does not match with the version release-$hudi_version"
+ exit 1
+else
+ echo "❗️ On tag $curr_tag"
+fi
+
+dist_repo_subpath=hudi-rs-$hudi_version
+
+work_dir="$TMPDIR$(date +'%Y-%m-%d-%H-%M-%S')"
+src_rel_dir="$work_dir/$dist_repo_subpath"
+echo ">>> Archiving branch $curr_branch to $src_rel_dir"
+mkdir -p "$src_rel_dir"
+git archive --format=tgz --output="$src_rel_dir/hudi-rs-$hudi_version.src.tgz"
"$curr_branch"
+echo "Done archiving."
+
+pushd "$src_rel_dir"
+echo ">>> Generating signature"
+for i in *.tgz; do
+ echo "$i"
+ gpg --local-user "$signing_key" --armor --output "$i.asc" --detach-sig "$i"
+done
+echo ">>> Checking signature"
+for i in *.tgz; do
+ echo "$i"
+ gpg --local-user "$signing_key" --verify "$i.asc" "$i"
+done
+echo ">>> Generating sha512sum"
+if [ "$(uname)" == "Darwin" ]; then
+ SHASUM="shasum -a 512"
+else
+ SHASUM="sha512sum"
+fi
+for i in *.tgz; do
+ echo "$i"
+ $SHASUM "$i" >"$i.sha512"
+done
+echo ">>> Checking sha512sum"
+for i in *.tgz; do
+ echo "$i"
+ $SHASUM --check "$i.sha512"
+done
+
+echo "✅ SUCCESS! Created source release at $src_rel_dir"
+for i in $(ls -a "$src_rel_dir"); do echo "|___$i"; done
+popd
+
+svn_dev_url="https://dist.apache.org/repos/dist/dev/hudi"
+svn_dev_dir="$work_dir/svn_dev"
+echo ">>> Checking out svn dev to $svn_dev_dir"
+svn co -q $svn_dev_url --depth=immediates "$svn_dev_dir"
+echo ">>> Checking if the same version dir exists in svn"
+src_rel_svn_dir="$svn_dev_dir/$dist_repo_subpath"
+if [ -d "$src_rel_svn_dir" ]; then
+ echo "❌ $dist_repo_subpath already exists!"
+ exit 1
+fi
+
+echo ">>> Copying source release files to $svn_dev_dir"
+cp -r "$src_rel_dir" "$svn_dev_dir/"
+echo "✅ SUCCESS! Placed source release at $src_rel_svn_dir"
+for i in $(ls -a "$src_rel_svn_dir"); do echo "|___$i"; done
+
+echo ">>> Publishing to $svn_dev_url"
+pushd "$svn_dev_dir"
+svn add "$dist_repo_subpath"
+svn commit -m "add $dist_repo_subpath"
+echo "✅ SUCCESS! Published $dist_repo_subpath to $svn_dev_url"
+popd
diff --git a/release/verify_src_release.sh b/release/verify_src_release.sh
index 2356fdd..73a6b68 100755
--- a/release/verify_src_release.sh
+++ b/release/verify_src_release.sh
@@ -22,29 +22,18 @@ set -o errexit
set -o nounset
if [[ $# -ne 2 ]]; then
- echo "Usage: $0 <dev|release> <hudi_version>"
+ echo "Usage: $0 <hudi_version> <dev|release>"
exit 1
fi
-repo=$1
-hudi_version=$2
+hudi_version=$1
+repo=$2
-dev_pattern="^[0-9]+\.[0-9]+\.[0-9]+-(alpha|beta|rc)\.[0-9]+$"
-release_pattern="^[0-9]+\.[0-9]+\.[0-9]+$"
+version_pattern="^[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?$"
-if [[ "$repo" == "dev" ]]; then
- if [[ ! "$hudi_version" =~ $dev_pattern ]]; then
- echo "ERROR: For 'dev' repo, version must be in format
X.Y.Z-[alpha|beta|rc].N (e.g., 0.1.0-rc.1)"
+if [[ ! "$hudi_version" =~ $version_pattern ]]; then
+ echo "ERROR: version must be in format X.Y.Z or X.Y.Z-rc.W"
exit 1
- fi
-elif [[ "$repo" == "release" ]]; then
- if [[ ! "$hudi_version" =~ $release_pattern ]]; then
- echo "ERROR: For 'release' repo, version must be in format X.Y.Z (e.g.,
0.1.0)"
- exit 1
- fi
-else
- echo "ERROR: Invalid repository type. Use 'dev' or 'release'."
- exit 1
fi
work_dir="$TMPDIR$(date +'%Y-%m-%d-%H-%M-%S')/svn_dir"