Ray Milkey | 3ac0079 | 2016-12-01 14:28:15 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Builds an ONOS release |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
Ray Milkey | 13d3ae3 | 2017-01-03 15:00:04 -0800 | [diff] [blame] | 6 | if [ $# -ne 3 -a $# -ne 4 ]; then |
Yuta HIGUCHI | 10b5357 | 2018-04-30 18:28:11 -0700 | [diff] [blame] | 7 | echo "Usage: onos-build-release branch version next-version [--dry-run]" |
Ray Milkey | 3ac0079 | 2016-12-01 14:28:15 -0800 | [diff] [blame] | 8 | 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 |
| 10 | fi |
| 11 | |
Ray Milkey | 13d3ae3 | 2017-01-03 15:00:04 -0800 | [diff] [blame] | 12 | if [ $# -eq 4 -a "${4}" != "--dry-run" ]; then |
| 13 | echo "$4 is an invalid parameter - only --dry-run allowed" |
| 14 | exit 1 |
| 15 | fi |
| 16 | |
Ray Milkey | 3ac0079 | 2016-12-01 14:28:15 -0800 | [diff] [blame] | 17 | BRANCH=$1 |
| 18 | VERSION=$2 |
| 19 | NEXT_VERSION=$3 |
Ray Milkey | 13d3ae3 | 2017-01-03 15:00:04 -0800 | [diff] [blame] | 20 | DRY_RUN=$4 |
Ray Milkey | 3ac0079 | 2016-12-01 14:28:15 -0800 | [diff] [blame] | 21 | |
| 22 | set -e |
| 23 | set -x |
| 24 | |
Ray Milkey | 13d3ae3 | 2017-01-03 15:00:04 -0800 | [diff] [blame] | 25 | IS_DRY_RUN=0 |
| 26 | if [ "${DRY_RUN}" == "--dry-run" ]; then |
| 27 | IS_DRY_RUN=1 |
| 28 | fi |
Ray Milkey | 3ac0079 | 2016-12-01 14:28:15 -0800 | [diff] [blame] | 29 | |
Ray Milkey | 13d3ae3 | 2017-01-03 15:00:04 -0800 | [diff] [blame] | 30 | # Check that environment setup is correct |
Ray Milkey | 78ce400 | 2018-08-10 11:16:44 -0700 | [diff] [blame^] | 31 | # onos-release-prerequisites ${DRY_RUN} |
Ray Milkey | 13d3ae3 | 2017-01-03 15:00:04 -0800 | [diff] [blame] | 32 | |
| 33 | if [ ${IS_DRY_RUN} -eq 0 ]; then |
| 34 | # Block commits to Gerrit |
| 35 | ssh -p 29418 gerrit.onosproject.org projectlock lock onos ${BRANCH} |
| 36 | fi |
Ray Milkey | 3ac0079 | 2016-12-01 14:28:15 -0800 | [diff] [blame] | 37 | |
| 38 | # Prepare the build tree |
Ray Milkey | 13d3ae3 | 2017-01-03 15:00:04 -0800 | [diff] [blame] | 39 | onos-prepare-release $VERSION $BRANCH "onos-build-and-upload $VERSION $NEXT_VERSION $BRANCH $DRY_RUN" |
Ray Milkey | 3ac0079 | 2016-12-01 14:28:15 -0800 | [diff] [blame] | 40 | |
Ray Milkey | 13d3ae3 | 2017-01-03 15:00:04 -0800 | [diff] [blame] | 41 | if [ ${IS_DRY_RUN} -eq 0 ]; then |
| 42 | # Unblock commits |
| 43 | ssh -p 29418 gerrit.onosproject.org projectlock unlock onos ${BRANCH} |
| 44 | fi |