blob: 82a1d78cb25787594bbe0575ece75242d42055af [file] [log] [blame]
#!/bin/bash -ex
# exit on errors
set -eu -o pipefail
ONOS_ROOT=`pwd`
. tools/build/envDefaults
PATH=$PATH:/home/jenkins/bin
# set up JDK 11 if needed
if [ ${GERRIT_BRANCH} == "master" -o ${GERRIT_BRANCH} == "onos-2.2" ]
then
echo Installing OPEN JDK 11
sudo update-java-alternatives -s java-11-amazon-corretto
java -version
else
echo Using default JDK
fi
# import GPG key
gpg --import jenkins.key
# set up release build credentials
. onos-build-credentials
# configure git settings
git config user.email "jenkins@onlab.us"
git config user.name "ONOS Jenkins User"
# stage the maven settings
mkdir -p ~/.m2
mv settings.xml ~/.m2/settings.xml
# set user to use for uploading javadocs
WIKI_USER="jenkins"
export WIKI_USER
# lock gerrit to prevent checkins
# FIXME: re-enable locking when projectlock will be added to new ONOS gerrit
# or change the release process to tag a specific commit instead of the whole branch
# ssh -p 29418 gerrit.onosproject.org projectlock lock onos ${GERRIT_BRANCH}
# unlock on exit
# trap "ssh -p 29418 gerrit.onosproject.org projectlock unlock onos ${GERRIT_BRANCH}" EXIT
# get the sources
git checkout $GERRIT_BRANCH
# run the build
onos-build-and-upload ${ONOS_VERSION} ${ONOS_NEXT_VERSION} ${GERRIT_BRANCH}
# upload API docs
BUILD_OUTPUT_PATH=${ONOS_ROOT}/bazel-bin/docs/tmp
SYNC_TARGET_SERVER=static.opennetworking.org
SYNC_TARGET_PATH=/srv/sites/api.onosproject.org/${ONOS_VERSION}
rsync -rvzh --delete-after --exclude=.git "$BUILD_OUTPUT_PATH" "$SYNC_TARGET_SERVER:$SYNC_TARGET_PATH"