blob: 6dd846a2271a77f17a9033248b01d674414d94a2 [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 -07009PATH=$PATH:/home/jenkins/bin
10
Ray Milkey4e5e77a2019-11-15 12:52:21 -080011# set up JDK 11 if needed
12if [ ${GERRIT_BRANCH} == "master" -o ${GERRIT_BRANCH} == "onos-2.2" ]
13then
14 echo Installing OPEN JDK 11
15 sudo update-java-alternatives -s java-11-amazon-corretto
16 java -version
17else
18 echo Using default JDK
19fi
20
Ray Milkey7c8b3f22018-08-13 15:01:12 -070021# import GPG key
22gpg --import jenkins.key
23
24# set up release build credentials
25. onos-build-credentials
26
27# configure git settings
28git config user.email "jenkins@onlab.us"
29git config user.name "ONOS Jenkins User"
30
31# install boto
32pip install -U boto
33
34# stage the maven settings
35mkdir -p ~/.m2
36mv settings.xml ~/.m2/settings.xml
37
38# stage and add the build SSH key
39chmod 600 id_rsa.pub
40ssh-add id_rsa.pub
41
42# Add the javadoc server to the list of known hosts
43ssh-keyscan -H -t rsa api.onosproject.org >>~/.ssh/known_hosts
44
45# set user to use for uploading javadocs
46WIKI_USER="jenkins"
47export WIKI_USER
48
Ray Milkey7c8b3f22018-08-13 15:01:12 -070049# lock gerrit to prevent checkins
Carmelo Casconeb603a712020-07-30 10:55:28 -070050# FIXME: re-enable locking when projectlock will be added to new ONOS gerrit
51# or change the release process to tag a specific commit instead of the whole branch
52# ssh -p 29418 gerrit.onosproject.org projectlock lock onos ${GERRIT_BRANCH}
Ray Milkey7c8b3f22018-08-13 15:01:12 -070053
54# unlock on exit
Carmelo Casconeb603a712020-07-30 10:55:28 -070055# trap "ssh -p 29418 gerrit.onosproject.org projectlock unlock onos ${GERRIT_BRANCH}" EXIT
Ray Milkey7c8b3f22018-08-13 15:01:12 -070056
57# get the sources
58git checkout $GERRIT_BRANCH
59
60# run the build
61onos-build-and-upload ${ONOS_VERSION} ${ONOS_NEXT_VERSION} ${GERRIT_BRANCH}