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 | curl -L -o bazel.sh https://github.com/bazelbuild/bazel/releases/download/0.15.2/bazel-0.15.2-installer-linux-x86_64.sh |
| 11 | chmod +x bazel.sh |
| 12 | ./bazel.sh --user |
| 13 | PATH=$PATH:/home/jenkins/bin |
| 14 | |
Ray Milkey | b867be8 | 2017-11-27 13:29:19 -0800 | [diff] [blame] | 15 | # import GPG key |
| 16 | gpg --import jenkins.key |
Yuta HIGUCHI | 4e751d0 | 2018-05-11 10:22:11 -0700 | [diff] [blame] | 17 | |
Ray Milkey | 2afc4a5 | 2017-11-17 11:01:38 -0800 | [diff] [blame] | 18 | # set up release build credentials |
| 19 | . onos-build-credentials |
| 20 | |
Ray Milkey | 8791b89 | 2017-12-12 11:02:41 -0800 | [diff] [blame] | 21 | # configure git settings |
| 22 | git config user.email "jenkins@onlab.us" |
Ray Milkey | 094fd00 | 2017-11-22 10:21:59 -0800 | [diff] [blame] | 23 | git config user.name "ONOS Jenkins User" |
| 24 | |
Ray Milkey | 8791b89 | 2017-12-12 11:02:41 -0800 | [diff] [blame] | 25 | # install boto |
| 26 | pip install -U boto |
| 27 | |
Ray Milkey | 43e7f93 | 2017-11-27 08:48:42 -0800 | [diff] [blame] | 28 | # stage the maven settings |
| 29 | mkdir -p ~/.m2 |
| 30 | mv settings.xml ~/.m2/settings.xml |
| 31 | |
Ray Milkey | 8791b89 | 2017-12-12 11:02:41 -0800 | [diff] [blame] | 32 | # stage and add the build SSH key |
| 33 | chmod 600 id_rsa.pub |
| 34 | ssh-add id_rsa.pub |
| 35 | |
| 36 | # Add the javadoc server to the list of known hosts |
| 37 | ssh-keyscan -H -t rsa api.onosproject.org >>~/.ssh/known_hosts |
Ray Milkey | 7d774fb | 2017-12-05 14:57:30 -0800 | [diff] [blame] | 38 | |
| 39 | # set user to use for uploading javadocs |
| 40 | WIKI_USER="jenkins" |
| 41 | export WIKI_USER |
| 42 | |
Ray Milkey | 8791b89 | 2017-12-12 11:02:41 -0800 | [diff] [blame] | 43 | # lock gerrit to prevent checkins |
Ray Milkey | 884a2b8 | 2018-05-22 08:29:45 -0700 | [diff] [blame] | 44 | ssh -p 29418 gerrit.onosproject.org projectlock lock onos ${GERRIT_BRANCH} |
Ray Milkey | 8791b89 | 2017-12-12 11:02:41 -0800 | [diff] [blame] | 45 | |
| 46 | # unlock on exit |
Ray Milkey | 884a2b8 | 2018-05-22 08:29:45 -0700 | [diff] [blame] | 47 | 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] | 48 | |
| 49 | # get the sources |
| 50 | git checkout $GERRIT_BRANCH |
| 51 | |
Ray Milkey | 2afc4a5 | 2017-11-17 11:01:38 -0800 | [diff] [blame] | 52 | # run the build |
| 53 | onos-build-and-upload ${ONOS_VERSION} ${ONOS_NEXT_VERSION} ${GERRIT_BRANCH} |