Meta scripts to do the entire release process with a single script invocation

Change-Id: If9826cff51978a4cc4147d9b437c3c4098b9c6c0
diff --git a/tools/build/check-uploaded-maven-artifacts b/tools/build/check-uploaded-maven-artifacts
index e81d35c..0db1d04 100755
--- a/tools/build/check-uploaded-maven-artifacts
+++ b/tools/build/check-uploaded-maven-artifacts
@@ -38,7 +38,7 @@
     expectedSha1 = localArtifactSha.hexdigest()
 
     if localSize != remoteSize:
-        print 'Size is wrong local ' + str(localSize) + ' but found remote ' + str(remoteSize)
+        print 'Size for ' + remoteUrl + ' is wrong local ' + str(localSize) + ' but found remote ' + str(remoteSize)
         sys.exit(1)
 
     sha1 = ''
diff --git a/tools/build/onos-build-and-upload b/tools/build/onos-build-and-upload
new file mode 100755
index 0000000..bdf2f36
--- /dev/null
+++ b/tools/build/onos-build-and-upload
@@ -0,0 +1,32 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Builds the release bits and uploads them.
+# -----------------------------------------------------------------------------
+
+VERSION=$1
+NEXT_VERSION=$2
+BRANCH=$3
+
+set -e
+set -x
+
+# fix version strings, build artifacts, upload artifacts
+onos-release $VERSION | tee build.log
+
+# upload docs
+onos-upload-docs ${WIKI_USER}
+
+# upload release bits
+onos-upload-bits
+
+# spot check that uploaded artifacts are correct
+check-uploaded-maven-artifacts  $VERSION $ONOS_ROOT https://oss.sonatype.org/content/groups/staging
+
+# set the version strings to the next version
+onos-snapshot ${NEXT_VERSION}
+
+# Push version string changes to git
+git push origin ${BRANCH}
+
+# Push tag for this build to git
+git push origin ${VERSION}
diff --git a/tools/build/onos-build-release b/tools/build/onos-build-release
new file mode 100755
index 0000000..ee39597
--- /dev/null
+++ b/tools/build/onos-build-release
@@ -0,0 +1,30 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Builds an ONOS release
+# -----------------------------------------------------------------------------
+
+if [ $# -ne 3 ]; then
+    echo "Usage: onos-build-release version next-version branch"
+    echo "For example, to build rc2 on the 1.8 branch - onos-build-release onos-1.8 1.8.0-rc2 1.8.0-SNAPSHOT"
+    exit 1
+fi
+
+BRANCH=$1
+VERSION=$2
+NEXT_VERSION=$3
+
+set -e
+set -x
+
+# Check that environment setup is correct
+onos-release-prerequisites
+
+# Block commits to Gerrit
+ssh -p 29418 gerrit.onosproject.org projectlock lock onos ${BRANCH}
+
+# Prepare the build tree
+onos-prepare-release $VERSION $BRANCH "onos-build-and-upload $VERSION $NEXT_VERSION $BRANCH"
+
+# Unblock commits
+ssh -p 29418 gerrit.onosproject.org projectlock unlock onos ${BRANCH}
+
diff --git a/tools/build/onos-prepare-release b/tools/build/onos-prepare-release
index 9c4ce71..4088869 100755
--- a/tools/build/onos-prepare-release
+++ b/tools/build/onos-prepare-release
@@ -4,9 +4,11 @@
 # --------------------------------------------------------
 
 set -e
+set -x
 
 GERRIT_USER=${GERRIT_USER:-$USER}
 BRANCH=${2:-master}
+COMMAND=${3:--i}
 
 export ONOS_VERSION=${1:-$ONOS_VERSION}
 if [ -z "$ONOS_VERSION" ]; then
@@ -35,6 +37,6 @@
 
 export ONOS_ROOT=$DIR
 . $ONOS_ROOT/tools/build/envDefaults
-exec bash -i
+exec bash $COMMAND
 
 # TODO on exit, print "leaving directory"