blob: 38d8fd6141b6cf1d07754bd9a63b1df1f114c078 [file] [log] [blame]
Ray Milkey3ac00792016-12-01 14:28:15 -08001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Builds an ONOS release
4# -----------------------------------------------------------------------------
5
Ray Milkey13d3ae32017-01-03 15:00:04 -08006if [ $# -ne 3 -a $# -ne 4 ]; then
Yuta HIGUCHI10b53572018-04-30 18:28:11 -07007 echo "Usage: onos-build-release branch version next-version [--dry-run]"
Ray Milkey3ac00792016-12-01 14:28:15 -08008 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"
9 exit 1
10fi
11
Ray Milkey13d3ae32017-01-03 15:00:04 -080012if [ $# -eq 4 -a "${4}" != "--dry-run" ]; then
13 echo "$4 is an invalid parameter - only --dry-run allowed"
14 exit 1
15fi
16
Ray Milkey3ac00792016-12-01 14:28:15 -080017BRANCH=$1
18VERSION=$2
19NEXT_VERSION=$3
Ray Milkey13d3ae32017-01-03 15:00:04 -080020DRY_RUN=$4
Ray Milkey3ac00792016-12-01 14:28:15 -080021
22set -e
23set -x
24
Ray Milkey13d3ae32017-01-03 15:00:04 -080025IS_DRY_RUN=0
26if [ "${DRY_RUN}" == "--dry-run" ]; then
27 IS_DRY_RUN=1
28fi
Ray Milkey3ac00792016-12-01 14:28:15 -080029
Ray Milkey13d3ae32017-01-03 15:00:04 -080030# Check that environment setup is correct
Ray Milkey78ce4002018-08-10 11:16:44 -070031# onos-release-prerequisites ${DRY_RUN}
Ray Milkey13d3ae32017-01-03 15:00:04 -080032
33if [ ${IS_DRY_RUN} -eq 0 ]; then
34 # Block commits to Gerrit
35 ssh -p 29418 gerrit.onosproject.org projectlock lock onos ${BRANCH}
36fi
Ray Milkey3ac00792016-12-01 14:28:15 -080037
38# Prepare the build tree
Ray Milkey13d3ae32017-01-03 15:00:04 -080039onos-prepare-release $VERSION $BRANCH "onos-build-and-upload $VERSION $NEXT_VERSION $BRANCH $DRY_RUN"
Ray Milkey3ac00792016-12-01 14:28:15 -080040
Ray Milkey13d3ae32017-01-03 15:00:04 -080041if [ ${IS_DRY_RUN} -eq 0 ]; then
42 # Unblock commits
43 ssh -p 29418 gerrit.onosproject.org projectlock unlock onos ${BRANCH}
44fi