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


##########
cassandra-analytics-release/finish_release.sh:
##########
@@ -0,0 +1,226 @@
+#!/bin/bash
+
+##### TO EDIT #####
+
+asf_username="${asf_username:-$USER}"
+
+ARTIFACTORY_API_KEY="${ARTIFACTORY_API_KEY:-XXXXXXXX}"
+
+if [ "x$ARTIFACTORY_API_KEY" = "xXXXXXXXX" ]; then
+    exit -e "Get your jfrog artifactory API Key from 
https://apache.jfrog.io/ui/admin/artifactory/user_profile and set 
ARTIFACTORY_API_KEY to it"
+fi
+
+# 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
+
+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; }
+
+###################
+
+asf_git_repo="${asf_git_repo:-g...@github.com:apache/cassandra-analytics.git}"
+
+if [ "x${asf_git_repo}" != "x...@github.com:apache/cassandra-analytics.git" ] 
; then
+    echo "Using ASF git repo ${asf_git_repo}"
+fi
+
+# 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>"
+    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"
+}
+
+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
+deb_release=${release/-/\~}
+
+if [ -z "$release" ]
+then
+    echo "Missing argument <release_version>"
+    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 [ "$release" == "$deb_release" ]
+then
+    echo "Publishing Analytics release $release"
+else
+    echo "Publishing Analytics release $release (debian uses $deb_release)"
+fi
+
+# "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="release-${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
+}
+
+echo "Deploying artifacts ..." 1>&3 2>&4
+cassandra_dir=$PWD
+
+#
+# Rename the git tag, removing the -tentative suffix
+#
+
+execute "cd $cassandra_dir"
+
+echo "Tagging release ..." 1>&3 2>&4
+execute "git checkout $release-tentative"
+
+# Ugly but somehow 'execute "git tag -a cassandra-analytics-$release -m 
'Apache Cassandra $release release' "' doesn't work
+echo "Apache Cassandra Analytics $release release" > "_tmp_msg_"
+execute "git tag -a cassandra-analytics-$release -F _tmp_msg_"
+rm _tmp_msg_
+execute "git push $git_asf_remote refs/tags/cassandra-analytics-$release"
+execute "git tag -d $release-tentative"
+execute "git push $git_asf_remote :refs/tags/$release-tentative"
+
+#
+# Move staging artifacts to release distribution location
+#
+
+tmp_dir=`mktemp -d`
+cd $tmp_dir
+echo "Apache Cassandra Analytics $release release" > "_tmp_msg_"
+execute "svn mv -F _tmp_msg_ 
https://dist.apache.org/repos/dist/dev/cassandra/cassandra-analytics/${release} 
https://dist.apache.org/repos/dist/release/cassandra/cassandra-analytics/";
+rm _tmp_msg_
+
+#
+# Determine deb/rpm repo series
+#
+
+idx=`expr index "$release" -`
+if [ $idx -eq 0 ]
+then
+    release_short=${release}
+else
+    release_short=${release:0:$((idx-1))}
+fi
+release_major=$(echo ${release_short} | cut -d '.' -f 1)
+release_minor=$(echo ${release_short} | cut -d '.' -f 2)
+repo_series="${release_major}${release_minor}x"

Review Comment:
   this section is not applicable



##########
cassandra-analytics-release/finish_release.sh:
##########
@@ -0,0 +1,226 @@
+#!/bin/bash
+
+##### TO EDIT #####
+
+asf_username="${asf_username:-$USER}"
+
+ARTIFACTORY_API_KEY="${ARTIFACTORY_API_KEY:-XXXXXXXX}"
+
+if [ "x$ARTIFACTORY_API_KEY" = "xXXXXXXXX" ]; then
+    exit -e "Get your jfrog artifactory API Key from 
https://apache.jfrog.io/ui/admin/artifactory/user_profile and set 
ARTIFACTORY_API_KEY to it"
+fi
+
+# 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
+
+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; }
+
+###################
+
+asf_git_repo="${asf_git_repo:-g...@github.com:apache/cassandra-analytics.git}"
+
+if [ "x${asf_git_repo}" != "x...@github.com:apache/cassandra-analytics.git" ] 
; then
+    echo "Using ASF git repo ${asf_git_repo}"
+fi
+
+# 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>"
+    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"
+}
+
+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
+deb_release=${release/-/\~}

Review Comment:
   We won't have a deb release



##########
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:
   I think we should collect values for both builds :
   
   - scala 2.12, java11, spark 3
   - scala 2.13, java11, spark 3
   
   Both staging numbers should be included in the email text below 



##########
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}";

Review Comment:
   Ideally this should not be changed, and you should be able to run the script 
with the `asf_git_repo` set to `https://github.com/bbotella` as part of your 
command variables
   
   ```suggestion
   asf_git_repo="${asf_git_repo:-https://gitbox.apache.org/repos/asf}";
   ```



-- 
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