Fixing cell-build to apply patch only if necessary.

Change-Id: I08dcb74d2e421e4fe12c015b5afba1bf282896be
This commit is contained in:
Thomas Vachuska 2018-08-06 20:09:53 -07:00
parent 2ff66b4cbf
commit bf6739d050

View File

@ -19,21 +19,20 @@ ssh -t -t $ONOS_USER@$OCN "
source ~/.bash_aliases source ~/.bash_aliases
cd \$ONOS_ROOT cd \$ONOS_ROOT
# Make sure the remote build machine is on the same commit hash as the local one
remoteCommit=\$(git log -n 1 | head -n1 | cut -d\ -f2)
# Clean-up the workspace and stash away any changes. # Clean-up the workspace and stash away any changes.
git clean -f git clean -f
git stash git stash
# Make sure the remote build machine is on the same commit hash as the local one
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
git checkout $baseCommit git checkout $baseCommit
fi fi
# Apply the patch # Apply the patch if necessary
git apply /tmp/$baseCommit.patch [ -s /tmp/$baseCommit.patch ] && git apply /tmp/$baseCommit.patch
# Run the build (neutralizing known environment mutations in SSH sessions) # Run the build (neutralizing known environment mutations in SSH sessions)
SHLVL=1 SSH_CLIENT=0 SSH_CONNECTION=0 bazel build onos SHLVL=1 SSH_CLIENT=0 SSH_CONNECTION=0 bazel build onos