blob: b195c743ba8ea38257bb7abbf4e2346bb6619ad6 [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
Zack Williams2c6c25e2019-08-29 16:31:20 -070016 sudo update-java-alternatives -s java-11-amazon-corretto
Ray Milkey5978eab2019-07-02 13:18:14 -070017 java -version
Ray Milkey51bfa5c2019-07-02 12:54:56 -070018else
19 echo Using default JDK
20fi
21
Ray Milkeyb867be82017-11-27 13:29:19 -080022# import GPG key
23gpg --import jenkins.key
Yuta HIGUCHI4e751d02018-05-11 10:22:11 -070024
Ray Milkey2afc4a52017-11-17 11:01:38 -080025# set up release build credentials
26. onos-build-credentials
27
Ray Milkey8791b892017-12-12 11:02:41 -080028# configure git settings
29git config user.email "jenkins@onlab.us"
Ray Milkey094fd002017-11-22 10:21:59 -080030git config user.name "ONOS Jenkins User"
31
Ray Milkey8791b892017-12-12 11:02:41 -080032# install boto
33pip install -U boto
34
Ray Milkey43e7f932017-11-27 08:48:42 -080035# stage the maven settings
36mkdir -p ~/.m2
37mv settings.xml ~/.m2/settings.xml
38
Ray Milkey7d774fb2017-12-05 14:57:30 -080039# set user to use for uploading javadocs
40WIKI_USER="jenkins"
41export WIKI_USER
42
Carmelo Casconeb603a712020-07-30 10:55:28 -070043# FIXME: re-enable locking when projectlock will be added to new ONOS gerrit
44# or change the release process to tag a specific commit instead of the whole branch
Ray Milkey8791b892017-12-12 11:02:41 -080045# lock gerrit to prevent checkins
Carmelo Casconeb603a712020-07-30 10:55:28 -070046# ssh -p 29418 gerrit.onosproject.org projectlock lock onos ${GERRIT_BRANCH}
Ray Milkey8791b892017-12-12 11:02:41 -080047
48# unlock on exit
Carmelo Casconeb603a712020-07-30 10:55:28 -070049# trap "ssh -p 29418 gerrit.onosproject.org projectlock unlock onos ${GERRIT_BRANCH}" EXIT
Ray Milkey8791b892017-12-12 11:02:41 -080050
51# get the sources
52git checkout $GERRIT_BRANCH
53
Ray Milkey2afc4a52017-11-17 11:01:38 -080054# run the build
55onos-build-and-upload ${ONOS_VERSION} ${ONOS_NEXT_VERSION} ${GERRIT_BRANCH}
Zack Williamse3683182022-07-29 11:34:26 -070056
57# upload API docs
58BUILD_OUTPUT_PATH=${ONOS_ROOT}/bazel-bin/docs/tmp
59
60SYNC_TARGET_SERVER=static.opennetworking.org
61SYNC_TARGET_PATH=/srv/sites/api.onosproject.org/${ONOS_VERSION}
62
63rsync -rvzh --delete-after --exclude=.git "$BUILD_OUTPUT_PATH" "$SYNC_TARGET_SERVER:$SYNC_TARGET_PATH"