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 |
Ray Milkey | 5978eab | 2019-07-02 13:18:14 -0700 | [diff] [blame^] | 16 | curl -L -o jdk.tar.gz -s https://cdn.azul.com/zulu/bin/zulu11.31.11-ca-jdk11.0.3-linux_x64.tar.gz |
| 17 | tar xf jdk.tar.gz |
| 18 | export JAVA_HOME="`pwd`/zulu11.31.11-ca-jdk11.0.3-linux_x64" |
| 19 | PATH="$JAVA_HOME/bin:$PATH" |
| 20 | java -version |
Ray Milkey | 51bfa5c | 2019-07-02 12:54:56 -0700 | [diff] [blame] | 21 | else |
| 22 | echo Using default JDK |
| 23 | fi |
| 24 | |
Ray Milkey | b867be8 | 2017-11-27 13:29:19 -0800 | [diff] [blame] | 25 | # import GPG key |
| 26 | gpg --import jenkins.key |
Yuta HIGUCHI | 4e751d0 | 2018-05-11 10:22:11 -0700 | [diff] [blame] | 27 | |
Ray Milkey | 2afc4a5 | 2017-11-17 11:01:38 -0800 | [diff] [blame] | 28 | # set up release build credentials |
| 29 | . onos-build-credentials |
| 30 | |
Ray Milkey | 8791b89 | 2017-12-12 11:02:41 -0800 | [diff] [blame] | 31 | # configure git settings |
| 32 | git config user.email "jenkins@onlab.us" |
Ray Milkey | 094fd00 | 2017-11-22 10:21:59 -0800 | [diff] [blame] | 33 | git config user.name "ONOS Jenkins User" |
| 34 | |
Ray Milkey | 8791b89 | 2017-12-12 11:02:41 -0800 | [diff] [blame] | 35 | # install boto |
| 36 | pip install -U boto |
| 37 | |
Ray Milkey | 43e7f93 | 2017-11-27 08:48:42 -0800 | [diff] [blame] | 38 | # stage the maven settings |
| 39 | mkdir -p ~/.m2 |
| 40 | mv settings.xml ~/.m2/settings.xml |
| 41 | |
Ray Milkey | 8791b89 | 2017-12-12 11:02:41 -0800 | [diff] [blame] | 42 | # stage and add the build SSH key |
| 43 | chmod 600 id_rsa.pub |
| 44 | ssh-add id_rsa.pub |
| 45 | |
| 46 | # Add the javadoc server to the list of known hosts |
| 47 | ssh-keyscan -H -t rsa api.onosproject.org >>~/.ssh/known_hosts |
Ray Milkey | 7d774fb | 2017-12-05 14:57:30 -0800 | [diff] [blame] | 48 | |
| 49 | # set user to use for uploading javadocs |
| 50 | WIKI_USER="jenkins" |
| 51 | export WIKI_USER |
| 52 | |
Ray Milkey | 8791b89 | 2017-12-12 11:02:41 -0800 | [diff] [blame] | 53 | # lock gerrit to prevent checkins |
Ray Milkey | 884a2b8 | 2018-05-22 08:29:45 -0700 | [diff] [blame] | 54 | ssh -p 29418 gerrit.onosproject.org projectlock lock onos ${GERRIT_BRANCH} |
Ray Milkey | 8791b89 | 2017-12-12 11:02:41 -0800 | [diff] [blame] | 55 | |
| 56 | # unlock on exit |
Ray Milkey | 884a2b8 | 2018-05-22 08:29:45 -0700 | [diff] [blame] | 57 | 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] | 58 | |
| 59 | # get the sources |
| 60 | git checkout $GERRIT_BRANCH |
| 61 | |
Ray Milkey | 2afc4a5 | 2017-11-17 11:01:38 -0800 | [diff] [blame] | 62 | # run the build |
| 63 | onos-build-and-upload ${ONOS_VERSION} ${ONOS_NEXT_VERSION} ${GERRIT_BRANCH} |