frankgh commented on code in PR #115:
URL: https://github.com/apache/cassandra-builds/pull/115#discussion_r2140627410


##########
cassandra-analytics-release/prepare_release.sh:
##########
@@ -0,0 +1,349 @@
+#!/bin/bash
+
+#set -o xtrace
+
+##### BEFORE YOU BEGIN #####
+
+# 1. Ensure your gpg configuration in ~/.gradle/gradle.properties
+#    For example:
+#    signing.gnupg.keyName=<your-key>
+#    signing.gnupg.passphrase=<your-passphrase>
+#    #signing.gnupg.executable=gpg # optional
+#    #signing.gnupg.useLegacyGpg=true # optional
+#    #signing.gnupg.homeDir=gnupg-home # optional
+#    #signing.gnupg.optionsFile=gnupg-home/gpg.conf # optional
+
+# 2. Ensure your maven credentials are configured in 
~/.gradle/gradle.properties
+#    For example:
+#    
maven.repository.url=https://repository.apache.org/service/local/staging/deploy/maven2
+#    maven.username=<asf-username>
+#    maven.password=<asf-password>
+
+##### TO EDIT #####
+
+asf_username="${asf_username:-$USER}"
+asf_username="bernardobotella"
+
+if [ "x${asf_username}" != "x${USER}" ] ; then
+  echo "Using ASF username ${asf_username}"
+fi
+echo "Using ASF username ${asf_username}"
+# The name of remote for the asf remote in your git repo
+git_asf_remote="${git_asf_remote:-origin}"
+
+if [ "x${git_asf_remote}" != "xorigin" ] ; then
+  echo "Using git ASF remote ${git_asf_remote}"
+fi
+
+# Where you want to put the mail draft that this script generate
+mail_dir="$HOME/Mail"
+
+###################
+# prerequisites
+
+command -v svn >/dev/null 2>&1 || { echo >&2 "subversion needs to be 
installed"; exit 1; }
+command -v git >/dev/null 2>&1 || { echo >&2 "git needs to be installed"; exit 
1; }
+command -v shasum >/dev/null 2>&1 || { echo >&2 "shasum needs to be 
installed"; exit 1; }
+
+###################
+#asf_git_repo="${asf_git_repo:-https://gitbox.apache.org/repos/asf}";
+asf_git_repo="${asf_git_repo:-https://github.com/bbotella}";
+
+if [ "x${asf_git_repo}" != "xhttps://gitbox.apache.org/repos/asf"; ] ; then
+    echo "Using ASF git repo ${asf_git_repo}"
+fi
+
+staging_repo="https://repository.apache.org/content/repositories";
+
+# Reset getopts in case it has been used previously in the shell.
+OPTIND=1
+
+# Initialize our own variables:
+verbose=0
+fake_mode=0
+
+show_help()
+{
+    local name=`basename $0`
+    echo "$name [options] <release_version> <java_11_home>"
+    echo ""
+    echo "where [options] are:"
+    echo "  -h: print this help"
+    echo "  -v: verbose mode (show everything that is going on)"
+    echo "  -f: fake mode, print any output but don't do anything (for 
debugging)"
+    echo ""
+    echo "Example: $name 1.0.0 /path/to/java11/home"
+}
+
+while getopts ":hvf" opt; do
+    case "$opt" in
+    h)
+        show_help
+        exit 0
+        ;;
+    v)  verbose=1
+        ;;
+    f)  fake_mode=1
+        ;;
+    \?)
+        echo "Invalid option: -$OPTARG" >&2
+        show_help
+        exit 1
+        ;;
+    esac
+done
+
+shift $(($OPTIND-1))
+
+release=$1
+
+if [ -z "$release" ]
+then
+    echo "Missing argument <release_version>"
+    show_help
+    exit 1
+fi
+
+shift
+
+java_11_home=$1
+
+if [ -z "$java_11_home" ]
+then
+    echo "Missing argument <java_11_home>"
+    show_help
+    exit 1
+fi
+
+if [ -x "${java_11_home}/bin/java" ]
+then
+    if [ "x$(${java_11_home}/bin/java -version 2>&1 | awk -F '"' '/version/ 
{print $2}' | cut -d '.' -f 1)" != "x11" ]
+    then
+        echo "Invalid java 11 version in ${java_11_home}"
+        show_help
+        exit 1
+    fi
+else
+    echo "Invalid java_11_home argument. No java executable found"
+    show_help
+    exit 1
+fi
+
+if [ "$#" -gt 1 ]
+then
+    shift
+    echo "Too many arguments. Don't know what to do with '$@'"
+    show_help
+    exit 1
+fi
+
+# Somewhat lame way to check we're in a git repo but that will do
+git log -1 &> /dev/null
+if [ $? -ne 0 ]
+then
+    echo "The current directory does not appear to be a git repository."
+    echo "You must run this from the Cassandra Analytics git source 
repository."
+    exit 1
+fi
+
+if ! git diff-index --quiet HEAD --
+then
+    echo "This git Cassandra Sidecar directory has uncommitted changes."
+    echo "You must run this from a clean Cassandra Analytics git source 
repository."
+    exit 1
+fi
+
+gradle_properties_version="$(grep ^version= gradle.properties)"
+if [ "${release}" != "${gradle_properties_version#version=}" ] ; then
+    echo "The release requested ${release} does not match gradle.properties's 
version ${gradle_properties_version}"
+    exit 1
+fi
+
+if curl --output /dev/null --silent --head --fail 
"https://dist.apache.org/repos/dist/dev/cassandra/cassandra-analytics/${release}";
 ; then
+    echo "The release candidate for ${release} is already staged at 
https://dist.apache.org/repos/dist/dev/cassandra/cassandra-analytics/${release}";
+    exit 1
+fi
+
+if curl --output /dev/null --silent --head --fail 
"https://archive.apache.org/dist/cassandra/cassandra-analytics/${release}"; ; 
then
+    echo "A published release for ${release} is already public at 
https://archive.apache.org/dist/cassandra/cassandra-analytics/${release}";
+    exit 1
+fi
+
+if curl --output /dev/null --silent --head --fail 
"https://github.com/apache/cassandra-analytics/tree/${release}-tentative"; ; then
+    echo "The release candidate tag for ${release}-tentative is already at 
https://github.com/apache/cassandra-analytics/tree/${release}-tentative";
+    exit 1
+fi
+
+if curl --output /dev/null --silent --head --fail 
"https://github.com/apache/cassandra-analytics/tree/cassandra-analytics-${release}";
 ; then
+    echo "The published release tag for ${release} is already at 
https://github.com/apache/cassandra-analytics/tree/cassandra-analytics-${release}";
+    exit 1
+fi
+
+if git tag -l | grep -q "${release}-tentative"; then
+    echo "Local git tag for ${release}-tentative already exists"
+    exit 1
+fi
+
+head_commit=`git log --pretty=oneline -1 | cut -d " " -f 1`
+
+echo "Preparing release for $release from commit:"
+
+echo ""
+git show $head_commit
+java -version
+
+echo "Is this what you want?"
+select yn in "Yes" "No"; do
+    case $yn in
+        Yes) break;;
+        No) echo "Alright, come back when you've made up your mind"; exit 0;;
+    esac
+done
+
+# "Saves" stdout to other descriptor since we might redirect them below
+exec 3>&1 4>&2
+
+if [ $verbose -eq 0 ]
+then
+    # Not verbose, redirect all output to a logfile
+    logfile="vote-${release}.log"
+    [ ! -e "$logfile" ] || rm $logfile
+    touch $logfile
+    exec > $logfile
+    exec 2> $logfile
+fi
+
+execute()
+{
+    local cmd=$1
+
+    echo ">> $cmd"
+    [ $fake_mode -eq 1 ] || $cmd
+    if [ $? -ne 0 ]
+    then
+        echo "Error running $cmd" 1>&3 2>&4
+        exit $?
+    fi
+}
+
+current_dir=`pwd`
+tmp_dir=`mktemp -d`
+distributions_dir=${tmp_dir}/cassandra-analytics/build/distributions
+
+echo "Tagging release ..." 1>&3 2>&4
+execute "git tag $release-tentative"
+execute "git push $git_asf_remote refs/tags/$release-tentative"
+
+echo "Cloning fresh repository ..." 1>&3 2>&4
+execute "cd $tmp_dir"
+## We clone from the original repository to make extra sure we're not 
screwing, even if that's definitively slower
+execute "git clone $asf_git_repo/cassandra-analytics.git"
+
+echo "Building and uploading artifacts ..." 1>&3 2>&4
+execute "cd $tmp_dir/cassandra-analytics"
+execute "git checkout -b $release-tentative"
+# Build java 11 artifacts and publish
+execute "./scripts/build-dependencies.sh"
+execute "./gradlew --no-daemon -Dorg.gradle.java.home=${java_11_home} clean"
+execute "./gradlew --no-daemon -Pscala=2.12 
-P-Dorg.gradle.java.home=${java_11_home} -PforceSigning -Prelease=true 
-Pversion=${release} assemble publish --stacktrace"
+execute "./gradlew --no-daemon -Pscala=2.13 
-Dorg.gradle.java.home=${java_11_home} -PforceSigning -Prelease=true 
-Pversion=${release} assemble publish --stacktrace"
+
+echo "Artifacts uploaded, find the staging repository on 
repository.apache.org, \"Close\" it, and indicate its staging number:" 1>&3 2>&4
+read -p "staging number Java 11? " staging_number 1>&3 2>&4

Review Comment:
   no, I believe they will be 2 different staging numbers. In Sidecar, we get 
two staging numbers , one for java 8 artifacts, and one for java 11 artifacts.



-- 
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: pr-unsubscr...@cassandra.apache.org

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


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

Reply via email to