You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@toree.apache.org by lr...@apache.org on 2026/09/16 09:00:01 UTC
(incubator-toree) 02/05: Refactor release script to separate prepare from publish
This is an automated email from the ASF dual-hosted git repository.
lresende pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-toree.git
commit 5d8e4cf206ac5e9dd24757615ef7cbbd226158f2
Author: Luciano Resende <lr...@apple.com>
AuthorDate: Fri May 1 19:19:48 2026 -0700
Refactor release script to separate prepare from publish
- release-prepare is now purely local: clone, version bump,
tag, and build. No external pushes (git, SVN, Maven).
- release-publish owns all external operations: push git commits
and tags, stage artifacts to Apache SVN dist/dev, deploy
assembly jar to Maven staging.
- Add dependency validation (fail-fast if git/svn/mvn/gpg missing)
- Add artifact validation before publish (verify all expected
tarballs, the assembly jar and the POM the deploy passes through
-DpomFile exist before any external push)
- publish reuses artifacts from prepare (no rebuild)
- publish-pip now uploads both toree and apache-toree packages
- Update help text, examples, and option descriptions
- Fix typo: "interaction" -> "iteration" in commit message
Validating the POM matters as much as the jar: the deploy is the last
step of publish, so a missing POM would otherwise surface only after the
release tag is pushed and the artifacts are committed to dist.apache.org.
---
etc/tools/release-build.sh | 257 +++++++++++++++++++++++++++++----------------
1 file changed, 165 insertions(+), 92 deletions(-)
diff --git a/etc/tools/release-build.sh b/etc/tools/release-build.sh
index d8359ec0..df2387b4 100755
--- a/etc/tools/release-build.sh
+++ b/etc/tools/release-build.sh
@@ -24,29 +24,35 @@ release-build - Creates build distributions from a git commit hash or from HEAD.
SYNOPSIS
-usage: release-build.sh [--release-prepare | --release-publish | --release-snapshot]
+usage: release-build.sh [--release-prepare | --release-publish]
DESCRIPTION
-Use maven infrastructure to create a project release package and publish
-to staging release location (https://dist.apache.org/repos/dist/dev/incubator/toree/)
-and maven staging release repository.
+Prepare and publish Apache Toree release artifacts.
---release-prepare --releaseVersion="0.2.0" --developmentVersion="0.2.0.dev1" [--releaseRc="rc1"] [--tag="v2.0.0"] [--gitCommitHash="a874b73"]
-This form execute maven release:prepare and upload the release candidate distribution
-to the staging release location.
+--release-prepare builds the release locally without pushing to any external
+system. Artifacts are left in target/toree/dist/ for review.
---release-publish --gitCommitHash="a874b73"
-Publish the maven artifacts of a release to the Apache staging maven repository.
+--release-publish publishes a previously prepared release: pushes git commits
+and tags, stages artifacts to Apache SVN dist/dev, and deploys the assembly
+jar to the Apache Maven staging repository.
+
+--release-prepare --releaseVersion="0.6.0" --developmentVersion="0.7.0.dev0" [--releaseRc="rc1"] [--tag="v0.6.0-incubating-rc1"] [--gitCommitHash="a874b73"] [--dryRun]
+Prepare a release locally: clone, version bump, tag, and build all artifacts.
+Use --dryRun to test version bump logic without building.
+
+--release-publish --releaseVersion="0.6.0" [--releaseRc="rc1"] [--tag="v0.6.0-incubating-rc1"]
+Publish a previously prepared release. Requires --release-prepare to have been
+run first. Does NOT support --dryRun.
OPTIONS
--releaseVersion - Release identifier used when publishing
---developmentVersion - Release identifier used for next development cyce
+--developmentVersion - Release identifier used for next development cycle
--releaseRc - Release RC identifier used when publishing, default 'rc1'
---tag - Release Tag identifier used when taging the release, default 'v$releaseVersion'
---gitCommitHash - Release tag or commit to build from, default master HEAD
---dryRun - Dry run only, mostly used for testing.
+--tag - Release Tag identifier used when tagging the release, default 'v\$releaseVersion-incubating-\$releaseRc'
+--gitCommitHash - Commit to build from, default master HEAD (prepare only)
+--dryRun - Dry run only, skips the build step (prepare only)
A GPG passphrase is expected as an environment variable
@@ -54,12 +60,12 @@ MAVEN_GPG_PASSPHRASE - Passphrase for GPG key used to sign release
EXAMPLES
-release-build.sh --release-prepare --releaseVersion="0.2.0" --developmentVersion="0.3.0.dev1"
-release-build.sh --release-prepare --releaseVersion="0.2.0" --developmentVersion="0.3.0.dev1" --releaseRc="rc1" --tag="v0.2.0-incubating-rc1"
-release-build.sh --release-prepare --releaseVersion="0.2.0" --developmentVersion="0.3.0.dev1" --releaseRc="rc1" --tag="v0.2.0-incubating-rc1" --gitCommitHash="a874b73" --dryRun
+release-build.sh --release-prepare --releaseVersion="0.6.0" --developmentVersion="0.7.0.dev0"
+release-build.sh --release-prepare --releaseVersion="0.6.0" --developmentVersion="0.7.0.dev0" --releaseRc="rc1" --tag="v0.6.0-incubating-rc1"
+release-build.sh --release-prepare --releaseVersion="0.6.0" --developmentVersion="0.7.0.dev0" --releaseRc="rc1" --dryRun
-release-build.sh --release-publish --gitCommitHash="a874b73"
-release-build.sh --release-publish --gitTag="v0.2.0-incubating-rc1"
+release-build.sh --release-publish --releaseVersion="0.6.0"
+release-build.sh --release-publish --releaseVersion="0.6.0" --releaseRc="rc1"
EOF
exit 1
@@ -152,6 +158,7 @@ fi
# https://github.com/apache/maven-gpg-plugin/blob/76316ce61699afaec7a298fd279e1c9133c38ac6/src/main/java/org/apache/maven/plugins/gpg/AbstractGpgMojo.java#L45
export MAVEN_GPG_PASSPHRASE
+# --release-prepare validation
if [[ "$RELEASE_PREPARE" == "true" && -z "$RELEASE_VERSION" ]]; then
echo "ERROR: --releaseVersion must be passed as an argument to run this script"
exit_with_usage
@@ -162,15 +169,10 @@ if [[ "$RELEASE_PREPARE" == "true" && -z "$DEVELOPMENT_VERSION" ]]; then
exit_with_usage
fi
-if [[ "$RELEASE_PUBLISH" == "true" ]]; then
- if [[ "$GIT_REF" && "$GIT_TAG" ]]; then
- echo "ERROR: Only one argumented permitted when publishing : --gitCommitHash or --gitTag"
- exit_with_usage
- fi
- if [[ -z "$GIT_REF" && -z "$GIT_TAG" ]]; then
- echo "ERROR: --gitCommitHash OR --gitTag must be passed as an argument to run this script"
- exit_with_usage
- fi
+# --release-publish validation
+if [[ "$RELEASE_PUBLISH" == "true" && -z "$RELEASE_VERSION" ]]; then
+ echo "ERROR: --releaseVersion must be passed as an argument to run this script"
+ exit_with_usage
fi
if [[ "$RELEASE_PUBLISH" == "true" && "$DRY_RUN" ]]; then
@@ -180,14 +182,10 @@ fi
# Commit ref to checkout when building
GIT_REF=${GIT_REF:-master}
-if [[ "$RELEASE_PUBLISH" == "true" && "$GIT_TAG" ]]; then
- GIT_REF="tags/$GIT_TAG"
-fi
BASE_DIR=$(pwd)
MVN="mvn"
-PUBLISH_PROFILES="-Pdistribution"
if [ -z "$RELEASE_RC" ]; then
RELEASE_RC="rc1"
@@ -205,7 +203,7 @@ RELEASE_STAGING_LOCATION="https://dist.apache.org/repos/dist/dev/incubator/toree
echo " "
echo "-------------------------------------------------------------"
-echo "------- Release preparation with the following parameters ---"
+echo "------- Release configuration -------------------------------"
echo "-------------------------------------------------------------"
echo "Executing ==> $GOAL"
echo "Git reference ==> $GIT_REF"
@@ -223,10 +221,60 @@ echo "Deploying to :"
echo $RELEASE_STAGING_LOCATION
echo " "
+function validate_dependency {
+ if ! command -v "$1" &> /dev/null; then
+ echo "ERROR: $1 is not installed or not on PATH"
+ exit 1
+ fi
+}
+
+function validate_prepare_dependencies {
+ echo "Validating prepare dependencies..."
+ validate_dependency git
+ validate_dependency docker
+ validate_dependency sbt
+}
+
+function validate_publish_dependencies {
+ echo "Validating publish dependencies..."
+ validate_dependency git
+ validate_dependency svn
+ validate_dependency mvn
+ validate_dependency gpg
+}
+
+function validate_artifacts {
+ echo "Validating release artifacts in target/toree/dist/..."
+ local has_error=false
+
+ local artifacts=(
+ "target/toree/dist/apache-toree-bin/apache-toree-$FULL_RELEASE_VERSION-bin.tar.gz"
+ "target/toree/dist/apache-toree-src/apache-toree-$FULL_RELEASE_VERSION-src.tar.gz"
+ "target/toree/dist/toree-pip/toree-$RELEASE_VERSION.tar.gz"
+ "target/toree/dist/apache-toree-pip/apache-toree-$RELEASE_VERSION.tar.gz"
+ "target/toree/dist/toree/lib/toree-assembly-$FULL_RELEASE_VERSION.jar"
+ "target/toree/dist/toree/toree-assembly-$FULL_RELEASE_VERSION.pom"
+ )
+
+ for artifact in "${artifacts[@]}"; do
+ if [ ! -f "$BASE_DIR/$artifact" ]; then
+ echo "ERROR: Missing artifact: $artifact"
+ has_error=true
+ fi
+ done
+
+ if [ "$has_error" = true ]; then
+ echo ""
+ echo "Release artifacts are incomplete. Run --release-prepare first."
+ exit 1
+ fi
+
+ echo "All release artifacts found."
+}
+
set -o xtrace
function checkout_code {
- # Checkout code
rm -rf target
mkdir target
cd target
@@ -240,26 +288,31 @@ function checkout_code {
cd "$BASE_DIR" #return to base dir
}
+###############################################################################
+# release-prepare
+#
+# Prepares a release locally: clone, version bump, tag, and build.
+# Does NOT push to any external system (git, SVN, Maven).
+###############################################################################
if [[ "$RELEASE_PREPARE" == "true" ]]; then
echo "Preparing release $FULL_RELEASE_VERSION ($RELEASE_VERSION)"
+
+ validate_prepare_dependencies
+
# Checkout code
checkout_code
cd target/toree
- # Build and prepare the release
+ # Bump version to release, commit, and tag
sed -i .bak "s@^BASE_VERSION.*@BASE_VERSION?=$RELEASE_VERSION@g" Makefile
git commit Makefile -m"Prepare release $FULL_RELEASE_VERSION"
git tag $RELEASE_TAG
git_tag_hash=`git rev-parse --short HEAD`
+
+ # Bump version to next development iteration
sed -i .bak "s@^BASE_VERSION.*@BASE_VERSION?=$DEVELOPMENT_VERSION@g" Makefile
- git commit Makefile -m"Prepare for next development interaction $DEVELOPMENT_VERSION"
+ git commit Makefile -m"Prepare for next development iteration $DEVELOPMENT_VERSION"
echo "Created release tag $RELEASE_TAG at git hash $git_tag_hash"
- if [ -n "$DRY_RUN" ]; then
- echo "DRY RUN: Skipping git push"
- else
- git push
- git push --tags
- fi
cd .. #exit toree
@@ -270,67 +323,77 @@ if [[ "$RELEASE_PREPARE" == "true" ]]; then
make clean dist release
- cd "$BASE_DIR/target"
- svn co $RELEASE_STAGING_LOCATION svn-toree
- mkdir -p svn-toree/$RELEASE_STAGING_FOLDER/apache-toree
- mkdir -p svn-toree/$RELEASE_STAGING_FOLDER/toree-pip
- mkdir -p svn-toree/$RELEASE_STAGING_FOLDER/apache-toree-pip
-
- cp toree/dist/apache-toree-bin/*.tar.gz svn-toree/$RELEASE_STAGING_FOLDER/apache-toree
- cp toree/dist/apache-toree-src/*.tar.gz svn-toree/$RELEASE_STAGING_FOLDER/apache-toree
- cp toree/dist/toree-pip/*.tar.gz svn-toree/$RELEASE_STAGING_FOLDER/toree-pip
- cp -r toree/dist/toree-pip/toree.egg-info svn-toree/$RELEASE_STAGING_FOLDER/toree-pip/
- cp toree/dist/apache-toree-pip/*.tar.gz svn-toree/$RELEASE_STAGING_FOLDER/apache-toree-pip
- cp -r toree/dist/apache-toree-pip/*toree.egg-info svn-toree/$RELEASE_STAGING_FOLDER/apache-toree-pip/
-
- cd "$BASE_DIR/target/svn-toree/$RELEASE_STAGING_FOLDER/apache-toree"
- rm -f *.asc
- for i in *.tar.gz; do gpg --output $i.asc --detach-sig --armor $i; done
- rm -f *.sha*
- for i in *.tar.gz; do shasum --algorithm 512 $i > $i.sha512; done
-
- cd "$BASE_DIR/target/svn-toree/$RELEASE_STAGING_FOLDER/toree-pip"
- rm -f *.asc
- for i in *.tar.gz; do gpg --output $i.asc --detach-sig --armor $i; done
- rm -f *.sha*
- for i in *.tar.gz; do shasum --algorithm 512 $i > $i.sha512; done
-
- cd "$BASE_DIR/target/svn-toree/$RELEASE_STAGING_FOLDER/apache-toree-pip"
- rm -f *.asc
- for i in *.tar.gz; do gpg --output $i.asc --detach-sig --armor $i; done
- rm -f *.sha*
- for i in *.tar.gz; do shasum --algorithm 512 $i > $i.sha512; done
-
- cd "$BASE_DIR/target/svn-toree/" #exit $RELEASE_STAGING_FOLDER/
-
- svn add $RELEASE_STAGING_FOLDER/
- svn ci -m"Apache Toree $RELEASE_STAGING_FOLDER"
-
- cd "$BASE_DIR/target"
- # The passphrase reaches the plugin through MAVEN_GPG_PASSPHRASE rather than the
- # command line, where it would be visible to any local user through ps.
- mvn "$MVN_GPG_PLUGIN:sign-and-deploy-file" \
- -Dfile="toree/dist/toree/lib/toree-assembly-$RELEASE_VERSION-incubating.jar" \
- -DpomFile="toree/dist/toree/toree-assembly-$RELEASE_VERSION-incubating.pom" \
- -DrepositoryId=apache.releases.https \
- -Durl=https://repository.apache.org/service/local/staging/deploy/maven2
+ # Create SVN staging folder locally for review
+ mkdir -p dist/svn-release/$RELEASE_STAGING_FOLDER/apache-toree
+ mkdir -p dist/svn-release/$RELEASE_STAGING_FOLDER/toree-pip
+ mkdir -p dist/svn-release/$RELEASE_STAGING_FOLDER/apache-toree-pip
+
+ cp dist/apache-toree-bin/* dist/svn-release/$RELEASE_STAGING_FOLDER/apache-toree/
+ cp dist/apache-toree-src/* dist/svn-release/$RELEASE_STAGING_FOLDER/apache-toree/
+ cp dist/toree-pip/*.tar.gz dist/toree-pip/*.asc dist/toree-pip/*.sha512 dist/svn-release/$RELEASE_STAGING_FOLDER/toree-pip/
+ cp -r dist/toree-pip/toree.egg-info dist/svn-release/$RELEASE_STAGING_FOLDER/toree-pip/
+ cp dist/apache-toree-pip/*.tar.gz dist/apache-toree-pip/*.asc dist/apache-toree-pip/*.sha512 dist/svn-release/$RELEASE_STAGING_FOLDER/apache-toree-pip/
+ cp -r dist/apache-toree-pip/*toree.egg-info dist/svn-release/$RELEASE_STAGING_FOLDER/apache-toree-pip/
fi
- cd "$BASE_DIR" #exit target
+ cd "$BASE_DIR" #return to base dir
+
+ echo ""
+ echo "-------------------------------------------------------------"
+ echo "------- Release preparation complete ------------------------"
+ echo "-------------------------------------------------------------"
+ echo ""
+ echo "Release artifacts are available at: $BASE_DIR/target/toree/dist/"
+ echo "SVN staging folder is assembled at: $BASE_DIR/target/toree/dist/svn-release/$RELEASE_STAGING_FOLDER"
+ echo ""
+ echo "Review the artifacts, then publish the release with:"
+ echo ""
+ echo " release-build.sh --release-publish --releaseVersion=\"$RELEASE_VERSION\" --releaseRc=\"$RELEASE_RC\""
+ echo ""
exit 0
fi
+###############################################################################
+# release-publish
+#
+# Publishes a previously prepared release. Pushes git commits and tags,
+# stages artifacts to Apache SVN dist/dev, and deploys the assembly jar
+# to the Apache Maven staging repository.
+#
+# Requires --release-prepare to have been run first.
+###############################################################################
if [[ "$RELEASE_PUBLISH" == "true" ]]; then
- echo "Preparing release $RELEASE_VERSION"
- # Checkout code
+ echo "Publishing release $FULL_RELEASE_VERSION ($RELEASE_VERSION)"
+
+ validate_publish_dependencies
+
+ # Verify that prepare was run and artifacts exist
+ if [ ! -d "$BASE_DIR/target/toree" ]; then
+ echo "ERROR: target/toree does not exist. Run --release-prepare first."
+ exit 1
+ fi
+
+ validate_artifacts
+
+ # Push release commits and tag to remote
cd "$BASE_DIR/target/toree"
- git checkout $RELEASE_TAG
- git clean -d -f -x
+ git checkout master
+ git push
+ git push --tags
- make clean dist release
+ # Stage artifacts in Apache SVN dist/dev
+ cd "$BASE_DIR/target"
+ svn co $RELEASE_STAGING_LOCATION svn-toree
+ cp -r toree/dist/svn-release/$RELEASE_STAGING_FOLDER svn-toree/
+
+ # Commit staged artifacts to SVN
+ cd "$BASE_DIR/target/svn-toree/"
+ svn add $RELEASE_STAGING_FOLDER/
+ svn ci -m"Apache Toree $RELEASE_STAGING_FOLDER"
+ # Deploy assembly jar to Apache Maven staging
cd "$BASE_DIR/target"
# The passphrase reaches the plugin through MAVEN_GPG_PASSPHRASE rather than the
# command line, where it would be visible to any local user through ps.
@@ -340,7 +403,17 @@ if [[ "$RELEASE_PUBLISH" == "true" ]]; then
-DrepositoryId=apache.releases.https \
-Durl=https://repository.apache.org/service/local/staging/deploy/maven2
- cd "$BASE_DIR" #exit target
+ cd "$BASE_DIR" #return to base dir
+
+ echo ""
+ echo "-------------------------------------------------------------"
+ echo "------- Release publish complete ----------------------------"
+ echo "-------------------------------------------------------------"
+ echo ""
+ echo "Git commits and tag pushed to remote"
+ echo "Artifacts staged to $RELEASE_STAGING_LOCATION$RELEASE_STAGING_FOLDER/"
+ echo "Assembly jar deployed to Apache Maven staging"
+ echo ""
exit 0
fi