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 | 4867af2 | 2018-08-10 16:52:28 -0700 | [diff] [blame] | 31 | onos-release-prerequisites ${DRY_RUN} |
Ray Milkey | 13d3ae3 | 2017-01-03 15:00:04 -0800 | [diff] [blame] | 32 | |
Carmelo Cascone | 00ff4ce | 2020-07-29 23:48:39 -0700 | [diff] [blame^] | 33 | # FIXME: re-enable locking when projectlock will be added to new ONOS gerrit |
| 34 | # or change the release process to tag a specific commit instead of the whole branch |
| 35 | #if [ ${IS_DRY_RUN} -eq 0 ]; then |
| 36 | # # Block commits to Gerrit |
| 37 | # ssh -p 29418 gerrit.onosproject.org projectlock lock onos ${BRANCH} |
| 38 | #fi |
Ray Milkey | 3ac0079 | 2016-12-01 14:28:15 -0800 | [diff] [blame] | 39 | |
| 40 | # Prepare the build tree |
Ray Milkey | 13d3ae3 | 2017-01-03 15:00:04 -0800 | [diff] [blame] | 41 | 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] | 42 | |
Carmelo Cascone | 00ff4ce | 2020-07-29 23:48:39 -0700 | [diff] [blame^] | 43 | # See FIXME above |
| 44 | #if [ ${IS_DRY_RUN} -eq 0 ]; then |
| 45 | # # Unblock commits |
| 46 | # ssh -p 29418 gerrit.onosproject.org projectlock unlock onos ${BRANCH} |
| 47 | #fi |