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