set -e
echo "Building ${BRANCH}"
rm -f ${WORKSPACE}/*.deb ${WORKSPACE}/calamari-repo-trusty.tar.gz
-cd ${WORKSPACE}/calamari/vagrant/trusty-build && vagrant destroy -f
-vagrant up
-vagrant ssh -c 'sudo salt-call --local state.highstate' | multitee 0-1,4 4>/tmp/${BUILD_TAG}.out
+cd ${WORKSPACE}/calamari/
+
+sudo apt-get -y install python-software-properties
+sudo add-apt-repository -y ppa:saltstack/salt
+sudo apt-get update
+wget -q -O- 'https://download.ceph.com/keys/release.asc' | sudo apt-key add -
+sudo ssh-keygen -f /root/.ssh/id_rsa -N ''
+sudo su -c 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys'
+ssh-keyscan $(hostname -f)| sudo tee -a /root/.ssh/known_hosts
+l:
+sudo apt-get -y install salt-minion salt-common python-jinja2
+
+sudo salt-call --local --file-root=$(pwd)/vagrant/trusty-build/salt/roots state.highstate | multitee 0-1,4 4>/tmp/${BUILD_TAG}.out
+
+
errs=$(sed --regexp-extended -n 's/^Failed:[[:space:]]+([[:digit:]]+)/\1/p' < /tmp/${BUILD_TAG}.out)
rm /tmp/${BUILD_TAG}.out
if [ $errs != 0 ] ; then echo "$errs HIGHSTATE ERRORS, BUILD FAILED"; exit 1; fi
-vagrant destroy -f
cd $WORKSPACE
rm -rf $BRANCH
mkdir $BRANCH