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