blob: f1f7c74f9f0bbf7df7d697fe70887f899810a503 [file] [log] [blame]
#!/bin/bash -ex
# exit on errors
set -eu -o pipefail
ONOS_ROOT=`pwd`
. tools/build/envDefaults
PATH=$PATH:/home/jenkins/bin
# 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"
# install boto
pip install -U boto
# stage the maven settings
mkdir -p ~/.m2
mv settings.xml ~/.m2/settings.xml
# stage and add the build SSH key
chmod 600 id_rsa.pub
ssh-add id_rsa.pub
# Add the javadoc server to the list of known hosts
ssh-keyscan -H -t rsa api.onosproject.org >>~/.ssh/known_hosts
# set user to use for uploading javadocs
WIKI_USER="jenkins"
export WIKI_USER
if [ ${GERRIT_BRANCH} == "onos-1.14" ]
then
curl -L -o bazel.sh https://github.com/bazelbuild/bazel/releases/download/0.15.2/bazel-0.15.2-installer-linux-x86_64.sh
fi
if [ ${GERRIT_BRANCH} == "onos-1.15" ]
then
curl -L -o bazel.sh https://github.com/bazelbuild/bazel/releases/download/0.17.1/bazel-0.17.1-installer-linux-x86_64.sh
fi
if [ ${GERRIT_BRANCH} == "master" ]
then
curl -L -o bazel.sh https://github.com/bazelbuild/bazel/releases/download/0.19.0/bazel-0.19.0-installer-linux-x86_64.sh
fi
chmod +x bazel.sh
./bazel.sh --user
PATH=$PATH:/home/jenkins/bin
# lock gerrit to prevent checkins
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}