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 | 8791b89 | 2017-12-12 11:02:41 -0800 | [diff] [blame] | 39 | # stage and add the build SSH key |
| 40 | chmod 600 id_rsa.pub |
| 41 | ssh-add id_rsa.pub |
| 42 | |
| 43 | # Add the javadoc server to the list of known hosts |
| 44 | ssh-keyscan -H -t rsa api.onosproject.org >>~/.ssh/known_hosts |
Ray Milkey | 7d774fb | 2017-12-05 14:57:30 -0800 | [diff] [blame] | 45 | |
| 46 | # set user to use for uploading javadocs |
| 47 | WIKI_USER="jenkins" |
| 48 | export WIKI_USER |
| 49 | |
Carmelo Cascone | b603a71 | 2020-07-30 10:55:28 -0700 | [diff] [blame] | 50 | # FIXME: re-enable locking when projectlock will be added to new ONOS gerrit |
| 51 | # 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] | 52 | # lock gerrit to prevent checkins |
Carmelo Cascone | b603a71 | 2020-07-30 10:55:28 -0700 | [diff] [blame] | 53 | # ssh -p 29418 gerrit.onosproject.org projectlock lock onos ${GERRIT_BRANCH} |
Ray Milkey | 8791b89 | 2017-12-12 11:02:41 -0800 | [diff] [blame] | 54 | |
| 55 | # unlock on exit |
Carmelo Cascone | b603a71 | 2020-07-30 10:55:28 -0700 | [diff] [blame] | 56 | # 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] | 57 | |
| 58 | # get the sources |
| 59 | git checkout $GERRIT_BRANCH |
| 60 | |
Ray Milkey | 2afc4a5 | 2017-11-17 11:01:38 -0800 | [diff] [blame] | 61 | # run the build |
| 62 | onos-build-and-upload ${ONOS_VERSION} ${ONOS_NEXT_VERSION} ${GERRIT_BRANCH} |