Improve release script to handle new release workflow 01/4101/1
authorThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 19 Aug 2016 04:20:18 +0000 (00:20 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 3 Feb 2017 17:04:40 +0000 (12:04 -0500)
See:
https://lists.opendaylight.org/pipermail/release/2016-June/006771.html

Change-Id: Iae9f5940c5eb2fe6024005843e2a966f593909f5
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
patch-odl-release.sh

index ed26cff..369ec59 100755 (executable)
@@ -31,6 +31,7 @@ fi
 
 PATCH_DIR=$1
 RELEASE_TAG=$2
+STABLE_BRANCH="stable/$( cut -d '-' -f1 <<< ${RELEASE_TAG,,})"
 
 project=${PWD##*/}
 scriptdir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
@@ -38,7 +39,6 @@ scriptdir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 # Validate that we're patching at the same commit level as when autorelease
 # built the release. Basically ensuring that no new patches snuck into the
 # project during code freeze.
-CURRENT_HASH=`git rev-parse HEAD`
 EXPECTED_HASH=`grep "^${project} " $PATCH_DIR/taglist.log | awk '{ print $2 }'`
 if [ "$EXPECTED_HASH" == "" ]; then
     parent_dir="$(dirname `pwd`)"
@@ -46,6 +46,9 @@ if [ "$EXPECTED_HASH" == "" ]; then
     EXPECTED_HASH=`grep "^${project} " $PATCH_DIR/taglist.log | awk '{ print $2 }'`
 fi
 
+git checkout "$EXPECTED_HASH"
+CURRENT_HASH=`git rev-parse HEAD`
+
 echo "Current Hash: $CURRENT_HASH"
 echo "Expected Hash: $EXPECTED_HASH"
 if [ "$CURRENT_HASH" != "$EXPECTED_HASH" ]
@@ -63,6 +66,9 @@ git merge FETCH_HEAD
 git tag -asm "OpenDaylight $RELEASE_TAG release" release/${RELEASE_TAG,,}
 find . -name pom.xml | xargs grep SNAPSHOT
 
+git checkout ${STABLE_BRANCH}
+# Release and then Bump so that the version.sh script creates the right patches
+$scriptdir/version.sh release $RELEASE_TAG
 $scriptdir/version.sh bump $RELEASE_TAG
 git commit -asm "Bumping versions by 0.0.1 for next dev cycle"
 find . -name pom.xml | xargs grep $RELEASE_TAG