blob: 78bdf85f12d845f61a299f753ae630e2351c09eb [file] [log] [blame]
Yuta HIGUCHI4e751d02018-05-11 10:22:11 -07001#!/bin/bash -e
Ray Milkey2afc4a52017-11-17 11:01:38 -08002
Ray Milkey8791b892017-12-12 11:02:41 -08003# exit on errors
4set -eu -o pipefail
5
Ray Milkey2afc4a52017-11-17 11:01:38 -08006# set up ONOS build environment
7ONOS_ROOT=`pwd`
8. tools/build/envDefaults
9
Ray Milkey771920f2018-08-14 16:10:58 -070010curl -L -o bazel.sh https://github.com/bazelbuild/bazel/releases/download/0.15.2/bazel-0.15.2-installer-linux-x86_64.sh
11chmod +x bazel.sh
12./bazel.sh --user
13PATH=$PATH:/home/jenkins/bin
14
Ray Milkeyb867be82017-11-27 13:29:19 -080015# import GPG key
16gpg --import jenkins.key
Yuta HIGUCHI4e751d02018-05-11 10:22:11 -070017
Ray Milkey2afc4a52017-11-17 11:01:38 -080018# set up release build credentials
19. onos-build-credentials
20
Ray Milkey8791b892017-12-12 11:02:41 -080021# configure git settings
22git config user.email "jenkins@onlab.us"
Ray Milkey094fd002017-11-22 10:21:59 -080023git config user.name "ONOS Jenkins User"
24
Ray Milkey8791b892017-12-12 11:02:41 -080025# install boto
26pip install -U boto
27
Ray Milkey43e7f932017-11-27 08:48:42 -080028# stage the maven settings
29mkdir -p ~/.m2
30mv settings.xml ~/.m2/settings.xml
31
Ray Milkey8791b892017-12-12 11:02:41 -080032# stage and add the build SSH key
33chmod 600 id_rsa.pub
34ssh-add id_rsa.pub
35
36# Add the javadoc server to the list of known hosts
37ssh-keyscan -H -t rsa api.onosproject.org >>~/.ssh/known_hosts
Ray Milkey7d774fb2017-12-05 14:57:30 -080038
39# set user to use for uploading javadocs
40WIKI_USER="jenkins"
41export WIKI_USER
42
Ray Milkey8791b892017-12-12 11:02:41 -080043# lock gerrit to prevent checkins
Ray Milkey884a2b82018-05-22 08:29:45 -070044ssh -p 29418 gerrit.onosproject.org projectlock lock onos ${GERRIT_BRANCH}
Ray Milkey8791b892017-12-12 11:02:41 -080045
46# unlock on exit
Ray Milkey884a2b82018-05-22 08:29:45 -070047trap "ssh -p 29418 gerrit.onosproject.org projectlock unlock onos ${GERRIT_BRANCH}" EXIT
Ray Milkey8791b892017-12-12 11:02:41 -080048
49# get the sources
50git checkout $GERRIT_BRANCH
51
Ray Milkey2afc4a52017-11-17 11:01:38 -080052# run the build
53onos-build-and-upload ${ONOS_VERSION} ${ONOS_NEXT_VERSION} ${GERRIT_BRANCH}