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