Yuta HIGUCHI | 4e751d0 | 2018-05-11 10:22:11 -0700 | [diff] [blame] | 1 | #!/bin/bash -e |
Ray Milkey | 2afc4a5 | 2017-11-17 11:01:38 -0800 | [diff] [blame] | 2 | |
Ray Milkey | 8791b89 | 2017-12-12 11:02:41 -0800 | [diff] [blame] | 3 | # exit on errors |
| 4 | set -eu -o pipefail |
| 5 | |
Ray Milkey | 2afc4a5 | 2017-11-17 11:01:38 -0800 | [diff] [blame] | 6 | # set up ONOS build environment |
| 7 | ONOS_ROOT=`pwd` |
| 8 | . tools/build/envDefaults |
| 9 | |
Ray Milkey | 771920f | 2018-08-14 16:10:58 -0700 | [diff] [blame] | 10 | PATH=$PATH:/home/jenkins/bin |
| 11 | |
Ray Milkey | 51bfa5c | 2019-07-02 12:54:56 -0700 | [diff] [blame] | 12 | # set up JDK 11 if needed |
| 13 | if [ ${GERRIT_BRANCH} == "master" -o ${GERRIT_BRANCH} == "onos-2.2" ] |
| 14 | then |
| 15 | echo Installing OPEN JDK 11 |
Zack Williams | 2c6c25e | 2019-08-29 16:31:20 -0700 | [diff] [blame] | 16 | sudo update-java-alternatives -s java-11-amazon-corretto |
Ray Milkey | 5978eab | 2019-07-02 13:18:14 -0700 | [diff] [blame] | 17 | java -version |
Ray Milkey | 51bfa5c | 2019-07-02 12:54:56 -0700 | [diff] [blame] | 18 | else |
| 19 | echo Using default JDK |
| 20 | fi |
| 21 | |
Ray Milkey | b867be8 | 2017-11-27 13:29:19 -0800 | [diff] [blame] | 22 | # import GPG key |
| 23 | gpg --import jenkins.key |
Yuta HIGUCHI | 4e751d0 | 2018-05-11 10:22:11 -0700 | [diff] [blame] | 24 | |
Ray Milkey | 2afc4a5 | 2017-11-17 11:01:38 -0800 | [diff] [blame] | 25 | # set up release build credentials |
| 26 | . onos-build-credentials |
| 27 | |
Ray Milkey | 8791b89 | 2017-12-12 11:02:41 -0800 | [diff] [blame] | 28 | # configure git settings |
| 29 | git config user.email "jenkins@onlab.us" |
Ray Milkey | 094fd00 | 2017-11-22 10:21:59 -0800 | [diff] [blame] | 30 | git config user.name "ONOS Jenkins User" |
| 31 | |
Ray Milkey | 8791b89 | 2017-12-12 11:02:41 -0800 | [diff] [blame] | 32 | # install boto |
| 33 | pip install -U boto |
| 34 | |
Ray Milkey | 43e7f93 | 2017-11-27 08:48:42 -0800 | [diff] [blame] | 35 | # stage the maven settings |
| 36 | mkdir -p ~/.m2 |
| 37 | mv settings.xml ~/.m2/settings.xml |
| 38 | |
Ray Milkey | 7d774fb | 2017-12-05 14:57:30 -0800 | [diff] [blame] | 39 | # set user to use for uploading javadocs |
| 40 | WIKI_USER="jenkins" |
| 41 | export WIKI_USER |
| 42 | |
Carmelo Cascone | b603a71 | 2020-07-30 10:55:28 -0700 | [diff] [blame] | 43 | # FIXME: re-enable locking when projectlock will be added to new ONOS gerrit |
| 44 | # or change the release process to tag a specific commit instead of the whole branch |
Ray Milkey | 8791b89 | 2017-12-12 11:02:41 -0800 | [diff] [blame] | 45 | # lock gerrit to prevent checkins |
Carmelo Cascone | b603a71 | 2020-07-30 10:55:28 -0700 | [diff] [blame] | 46 | # ssh -p 29418 gerrit.onosproject.org projectlock lock onos ${GERRIT_BRANCH} |
Ray Milkey | 8791b89 | 2017-12-12 11:02:41 -0800 | [diff] [blame] | 47 | |
| 48 | # unlock on exit |
Carmelo Cascone | b603a71 | 2020-07-30 10:55:28 -0700 | [diff] [blame] | 49 | # trap "ssh -p 29418 gerrit.onosproject.org projectlock unlock onos ${GERRIT_BRANCH}" EXIT |
Ray Milkey | 8791b89 | 2017-12-12 11:02:41 -0800 | [diff] [blame] | 50 | |
| 51 | # get the sources |
| 52 | git checkout $GERRIT_BRANCH |
| 53 | |
Ray Milkey | 2afc4a5 | 2017-11-17 11:01:38 -0800 | [diff] [blame] | 54 | # run the build |
| 55 | onos-build-and-upload ${ONOS_VERSION} ${ONOS_NEXT_VERSION} ${GERRIT_BRANCH} |
Zack Williams | e368318 | 2022-07-29 11:34:26 -0700 | [diff] [blame^] | 56 | |
| 57 | # upload API docs |
| 58 | BUILD_OUTPUT_PATH=${ONOS_ROOT}/bazel-bin/docs/tmp |
| 59 | |
| 60 | SYNC_TARGET_SERVER=static.opennetworking.org |
| 61 | SYNC_TARGET_PATH=/srv/sites/api.onosproject.org/${ONOS_VERSION} |
| 62 | |
| 63 | rsync -rvzh --delete-after --exclude=.git "$BUILD_OUTPUT_PATH" "$SYNC_TARGET_SERVER:$SYNC_TARGET_PATH" |