You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2015/08/01 22:44:05 UTC

svn commit: r10042 - /dev/jclouds/prepare_release.sh

Author: nacx
Date: Sat Aug  1 20:44:04 2015
New Revision: 10042

Log:
Release process clones the branch to start from a clean state

Modified:
    dev/jclouds/prepare_release.sh

Modified: dev/jclouds/prepare_release.sh
==============================================================================
--- dev/jclouds/prepare_release.sh (original)
+++ dev/jclouds/prepare_release.sh Sat Aug  1 20:44:04 2015
@@ -22,59 +22,45 @@ REPOS=(jclouds jclouds-labs jclouds-labs
 set -ue
 
 function usage {
-    echo "Usage: ${0} -r <release version> -n <next snapshot>"
+    echo "Usage: ${0} -r <release version> -n <next snapshot> -b <branch to release>"
     exit 1
 }
 
 [[ $# -gt 0 ]] || usage
 
-while getopts "r:n:" OPT; do
+while getopts "r:n:b:" OPT; do
     case ${OPT} in
         r) RELEASE=${OPTARG} ;;
         n) NEXT=${OPTARG} ;;
+        b) BRANCH=${OPTARG} ;;
         *) usage ;;
     esac
 done
 
 [[ "${RELEASE}" == "" ]] && usage
 [[ "${NEXT}" == "" ]] && usage
+[[ "${BRANCH}" == "" ]] && usage
 
-for REPO in ${REPOS[@]}; do
-    if ! [[ -d ${REPO} ]]; then
-        echo "${REPO} repo not found. Are you in the wrong directory?"
-        exit 1
-    fi
-    cd ${REPO}
-    ASF_REMOTE=`git remote -v | grep "repos/asf/${REPO}.git"`
-    if [[ "${ASF_REMOTE}" == "" ]]; then
-        echo "Could not find the ASF remote repo in ${REPO}"
-        exit 1
-    fi
-    cd ..
-done
-
-function current_branch {
-    cd ${1}
-    echo `git rev-parse --abbrev-ref HEAD`
-    cd ..
-}
-
-function current_snapshot {
-    echo `grep SNAPSHOT ${1}/pom.xml | head -n 1 | cut -d'>' -f2 | cut -d'<' -f1`
-}
+if [[ -e ${BRANCH} ]]; then
+    echo "File or directory ${BRANCH} exists but the release process needs it."
+    echo "Please, remove or move it elsewhere before continuing."
+    exit 1
+fi
 
 function rc_version {
-    cd ${1}
-    ASF_REMOTE=`git remote -v | grep "repos/asf/${1}.git" | head -n 1 | awk '{print $1}'`
-    git fetch ${ASF_REMOTE} --tags
-    LAST_RC=`git tag | grep ${1}-${RELEASE}-rc | sort -r | head -n 1`
+    LAST_RC=`git ls-remote --tags https://git-wip-us.apache.org/repos/asf/jclouds.git jclouds-${RELEASE}-rc* \
+        |awk '{print $2}' |grep "[0-9]$" |cut -d'/' -f3 |sort -r |head -n 1`
     if [[ "${LAST_RC}" == "" ]]; then
         echo "rc1"
     else
         NUMBER=`awk -F'rc' '{print $NF}' <<< ${LAST_RC}`
         echo "rc$((NUMBER+1))"
     fi
-    cd ..
+}
+
+function current_snapshot {
+    echo `curl -L "https://git-wip-us.apache.org/repos/asf?p=jclouds.git;a=blob_plain;f=pom.xml;hb=refs/heads/${BRANCH}" \
+        2>/dev/null |grep SNAPSHOT |head -n 1 |cut -d'>' -f2 |cut -d'<' -f1`
 }
 
 function join {
@@ -83,13 +69,13 @@ function join {
     echo "$*"
 }
 
-BRANCH=$(current_branch jclouds)
-CURRENT=$(current_snapshot jclouds)
-RC=$(rc_version jclouds)
+echo "Collecting release info..."
+CURRENT=$(current_snapshot)
+RC=$(rc_version)
 
 cat << EOF
 The release process will start with the following properties:
-  - Current branch: ${BRANCH}
+  - Release branch: ${BRANCH}
   - Current SNAPSHOT: ${CURRENT}
   - Release version: ${RELEASE}
   - Next SNAPSHOT: ${NEXT}
@@ -102,6 +88,13 @@ read -p "Do you want to continue? (y|n)
 
 echo -e "\nGo grab a beer. This will take a while! :-)\n"
 
+mkdir ${BRANCH}
+cd ${BRANCH}
+
+for REPO in ${REPOS[@]}; do
+    git clone https://git-wip-us.apache.org/repos/asf/${REPO}.git --single-branch -b ${BRANCH}
+done
+
 for REPO in ${REPOS[@]}; do
     TAG=${REPO}-${RELEASE}-${RC}
 
@@ -152,6 +145,14 @@ for REPO in ${REPOS[@]}; do
     cd ..
 done
 
+# Push the tags
+for REPO in ${REPOS[@]}; do
+    TAG=${REPO}-${RELEASE}-${RC}
+    cd ${REPO}
+    git push origin ${TAG}
+    cd ..
+done
+
 cat << EOF
 ***********************************************************************
 
@@ -160,7 +161,6 @@ to the staging repository at: https://re
 
 To complete the release:
   * Close the staging repository
-  * Once closed, push the tag in each repo to the ASF git repo.
   * Run the script to download the release tarballs and upload them
     to the RC svn directory.
   * Generate the JIRA release notes.