blob: a0767337d53072577ef49dcf800b88117cfa0b04 [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 -070010PATH=$PATH:/home/jenkins/bin
11
Ray Milkey51bfa5c2019-07-02 12:54:56 -070012# set up JDK 11 if needed
13if [ ${GERRIT_BRANCH} == "master" -o ${GERRIT_BRANCH} == "onos-2.2" ]
14then
15 echo Installing OPEN JDK 11
Ray Milkey5978eab2019-07-02 13:18:14 -070016 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 Milkey51bfa5c2019-07-02 12:54:56 -070021else
22 echo Using default JDK
23fi
24
Ray Milkeyb867be82017-11-27 13:29:19 -080025# import GPG key
26gpg --import jenkins.key
Yuta HIGUCHI4e751d02018-05-11 10:22:11 -070027
Ray Milkey2afc4a52017-11-17 11:01:38 -080028# set up release build credentials
29. onos-build-credentials
30
Ray Milkey8791b892017-12-12 11:02:41 -080031# configure git settings
32git config user.email "jenkins@onlab.us"
Ray Milkey094fd002017-11-22 10:21:59 -080033git config user.name "ONOS Jenkins User"
34
Ray Milkey8791b892017-12-12 11:02:41 -080035# install boto
36pip install -U boto
37
Ray Milkey43e7f932017-11-27 08:48:42 -080038# stage the maven settings
39mkdir -p ~/.m2
40mv settings.xml ~/.m2/settings.xml
41
Ray Milkey8791b892017-12-12 11:02:41 -080042# stage and add the build SSH key
43chmod 600 id_rsa.pub
44ssh-add id_rsa.pub
45
46# Add the javadoc server to the list of known hosts
47ssh-keyscan -H -t rsa api.onosproject.org >>~/.ssh/known_hosts
Ray Milkey7d774fb2017-12-05 14:57:30 -080048
49# set user to use for uploading javadocs
50WIKI_USER="jenkins"
51export WIKI_USER
52
Ray Milkey8791b892017-12-12 11:02:41 -080053# lock gerrit to prevent checkins
Ray Milkey884a2b82018-05-22 08:29:45 -070054ssh -p 29418 gerrit.onosproject.org projectlock lock onos ${GERRIT_BRANCH}
Ray Milkey8791b892017-12-12 11:02:41 -080055
56# unlock on exit
Ray Milkey884a2b82018-05-22 08:29:45 -070057trap "ssh -p 29418 gerrit.onosproject.org projectlock unlock onos ${GERRIT_BRANCH}" EXIT
Ray Milkey8791b892017-12-12 11:02:41 -080058
59# get the sources
60git checkout $GERRIT_BRANCH
61
Ray Milkey2afc4a52017-11-17 11:01:38 -080062# run the build
63onos-build-and-upload ${ONOS_VERSION} ${ONOS_NEXT_VERSION} ${GERRIT_BRANCH}