mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-18 19:01:06 +02:00
Enhancing cell-build to provide option to use shared cache.
Change-Id: I8ddd43cfec6bd0c6ce9acbbaa18ab0bad53307f0
This commit is contained in:
parent
c92311616d
commit
c661c20db0
@ -6,19 +6,23 @@
|
|||||||
# Check environment
|
# Check environment
|
||||||
[ -z "$OCN" ] && echo "Cell environment not established" && exit 1
|
[ -z "$OCN" ] && echo "Cell environment not established" && exit 1
|
||||||
|
|
||||||
runTests=""
|
runTests=false
|
||||||
|
useCache=false
|
||||||
|
|
||||||
while getopts b:t?h o; do
|
while getopts b:ct?h o; do
|
||||||
case "$o" in
|
case "$o" in
|
||||||
b) branch=$OPTARG;;
|
b) branch=$OPTARG;;
|
||||||
|
c) useCache=true;;
|
||||||
t) runTests=true;;
|
t) runTests=true;;
|
||||||
*) echo "usage: cell-build [-b branch] [-t] [commitHash]" >&2; exit 1;;
|
*) echo "usage: cell-build [-b branch] [-ct] [commitHash]" >&2; exit 1;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
let OPC=$OPTIND-1
|
let OPC=$OPTIND-1
|
||||||
shift $OPC
|
shift $OPC
|
||||||
|
|
||||||
|
! git status &>/dev/null && echo "Not in a git workspace. Exiting..." && exit $?
|
||||||
|
|
||||||
# Check arguments and environment
|
# Check arguments and environment
|
||||||
branch=${branch:-origin/master}
|
branch=${branch:-origin/master}
|
||||||
baseCommit=${1:-$(git log | grep $branch | head -n1 | cut -d\ -f2)}
|
baseCommit=${1:-$(git log | grep $branch | head -n1 | cut -d\ -f2)}
|
||||||
@ -41,17 +45,19 @@ ssh -t -t $ONOS_USER@$OCN "
|
|||||||
remoteCommit=\$(git log -n 1 | head -n1 | cut -d\ -f2)
|
remoteCommit=\$(git log -n 1 | head -n1 | cut -d\ -f2)
|
||||||
if [ "\$remoteCommit" != "$baseCommit" ]; then
|
if [ "\$remoteCommit" != "$baseCommit" ]; then
|
||||||
git checkout master
|
git checkout master
|
||||||
git pull
|
git pull --no-stat
|
||||||
git checkout $baseCommit
|
git checkout $baseCommit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Apply the patch if necessary
|
# Apply the patch if necessary
|
||||||
[ -s /tmp/$baseCommit.patch ] && git apply /tmp/$baseCommit.patch
|
[ -s /tmp/$baseCommit.patch ] && git apply /tmp/$baseCommit.patch
|
||||||
|
|
||||||
|
# Promote the common bazelrc file to enable running against the cells cache
|
||||||
|
[ $useCache = true ] && cp ~/.bazelrc .bazelrc
|
||||||
|
|
||||||
# Run the build (neutralizing known environment mutations in SSH sessions)
|
# Run the build (neutralizing known environment mutations in SSH sessions)
|
||||||
set -e
|
set -e
|
||||||
SHLVL=1 SSH_CLIENT=0 SSH_CONNECTION=0 bazel build onos
|
SHLVL=1 SSH_CLIENT=0 SSH_CONNECTION=0 bazel build onos
|
||||||
if [ $runTests = true ]; then
|
[ $runTests = true ] && \
|
||||||
bazel query 'tests(//...)' | SHLVL=1 SSH_CLIENT=0 SSH_CONNECTION=0 xargs bazel test
|
bazel query 'tests(//...)' | SHLVL=1 SSH_CLIENT=0 SSH_CONNECTION=0 xargs bazel test
|
||||||
fi
|
|
||||||
"
|
"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user